Question

In: Computer Science

1. Write the statements to create a table named REQUIREMENTS. The table has the following columns:...

1. Write the statements to create a table named REQUIREMENTS. The table has the following columns: credits number (primary key) and degree name.

2. Write the statements to create a table named CANDIDATE with the following columns names. Pick the best column type: student_id, first name, last name, credits and graduation date. The credits column is a foreign key to the credits column in the REQUIREMENTS table.

3. Write the statement(s) to Insert 2 rows in your REQUIREMENTS table. Make up your own data.

4. Write the statement(s) to insert 2 rows in your CANDIDATE table.

5. Add a new row to the CANDIDATE table.

Solutions

Expert Solution

ANSWERS

1) CREATE TABLE REQUIREMENTS (

credits number int PRIMARY KEY,

degree name varchar(100)

);

In the above statement we are create a table with the create table command and then write the name of the table and in the brackets I write the column names and then by giving space I wrote the data type of that column and then give the corressponding constraints of it and then giving another column name seperated by a coma(,). This is the syntax of creating a table. And write constraint if there is any constraint applied on that column otherwise no need of applying the constraints in any column. And if you are facing any error related to the column name then you could remove the space from the column name within itself.

2) CREATE TABLE CANDIDATE(

student_id varchar(50),

first name varchar(100).

last name varchar(100),

credits int,

graduation date date,

FOREIGN KEY (credits) REFERENCES REQUIREMENTS(credits number)

);

In the above statement I creates a table by giving colmn name then its datatype with its size in the brackets and in the last the credits column is the foreign key from the REQUIREMENTS table so that I take credits column as a foreign key references to the REQUIREMENTS table with its 'credits number' column in the bracket after the name of the table. This is the syntax of taking a foreign key from any other table. First you have to write foreign key then write the column name of that table which you want to make a foreign key write its name in the brackets then write references then write the table name of that table from which you wants to take reference and then write its column name in the brackets.

3)  INSERT INTO REQUIREMENTS VALUES ( 08, 'Bachelor of Technology');

INSERT INTO REQUIREMENTS VALUES ( 07, 'Bachelor of Science');

In the above statements there are two statements of inserting two rows in the requirements table. The syntax is "INSERT INTO table_name VALUES (value1, value2, value3, ...); " in which values should be according to the sequence of the columns. And if you want to insert the value in the perticular column then you can also do it by specifying that column after writing the table name in the brackets.

4)  INSERT INTO CANDIDATE VALUES ('BCS1903' , 'Robert' , 'Pattinson' , 08, '2022-11-20');

INSERT INTO CANDIDATE VALUES ('BIT1723' , 'Emma' , 'Watson' , 07, '2020-12-15');

In the baove statements there are two statements of inserting two rows in the candidate table. while inserting the date the format of date is 'YYYY-MM-DD' and if the values is of number type then we will write it without inverted comas and if any character is in the value then we have to write it in the inverted coma.

5)  INSERT INTO CANDIDATE VALUES ('MBA1945' , 'Hannah' , 'Bakker' , 06 , '2023-06-30');

In the above statement we are adding a new row in the candidate table with the values corressponding to the columns of the candidate table according to its sequence.

If you have any problem with the answers then please comment on it. And Please give me an upvote.


Related Solutions

Create a class named “Car” which has the following fields. The fields correspond to the columns...
Create a class named “Car” which has the following fields. The fields correspond to the columns in the text file except the last one. i. Vehicle_Name : String ii. Engine_Number : String iii. Vehicle_Price : double iv. Profit : double v. Total_Price : double (Total_Price = Vehicle_Price + Vehicle_Price* Profit/100) 2. Write a Java program to read the content of the text file. Each row has the attributes of one Car Object (except Total_Price). 3. After reading the instances of...
Using Python, write a program named hw3a.py that meets the following requirements: Create a dictionary called...
Using Python, write a program named hw3a.py that meets the following requirements: Create a dictionary called glossary. Have the glossary include a list of five (5) programing words you have learned in chapters 4-6. Use these words as keys to your dictionary. Find the definition of these words and use them as the values to the keys. Using a loop, print each word and its meaning as neatly formatted output. Create three dictionaries called person. Have each of the person...
SUBJECT: PROGRAMMING IN SQL 1. Create a view named vDepartmentInstructors that returns these columns: the DepartmentName...
SUBJECT: PROGRAMMING IN SQL 1. Create a view named vDepartmentInstructors that returns these columns: the DepartmentName column from the Departments table the LastName, FirstName, Status, and AnnualSalary columns from the Instructors table. 2. Write a SELECT statement that returns all the columns from the vDepartmentInstructors view that you created in question 1. Return one row for each fulltime instructor in the English department. 3. Write an UPDATE statement that updates the vDepartmentInstructors view you created in question 1 so it...
3. Write the statements to: • create a user named FooBar with a password of “candybar”...
3. Write the statements to: • create a user named FooBar with a password of “candybar” • assign the payments role created in the previous question to FooBar • assign the create session privilege to FooBar • Show the statements to connect to FooBar 4. For this question, I only need the query statement and not the results. Write the queries that use the user_sys_privs, user_tab_privs, user_role_privs, role_sys_privs and role_tab_privs objects to view the user and role privileges that are...
MATLAB Create a matrix named P which has 2000 rows and 100 columns of all zeros....
MATLAB Create a matrix named P which has 2000 rows and 100 columns of all zeros. Replace the zeros in rows 46-58 and columns 3-18 of matrix P from the previous question with ones.
1 – Create a webpage that contains a table with exactly three rows and two columns....
1 – Create a webpage that contains a table with exactly three rows and two columns. The first row will contain a table heading containing the name of a US National Park, that spans across all columns. Hint: use the colspan attribute inside the opening th tag Give the table heading an onmouseover that will change the text of the heading when it is moused over to read My Favorites Park! (Hint: use innerHTML). Use onmouseout to change it back....
1 – Create a webpage that contains a table with exactly three rows and two columns....
1 – Create a webpage that contains a table with exactly three rows and two columns. The first row will contain a table heading containing the name of a US National Park, that spans across all columns. Hint: use the colspan attribute inside the opening th tag Give the table heading an onmouseover that will change the text of the heading when it is moused over to read My Favorites Park! (Hint: use innerHTML). Use onmouseout to change it back....
Write CREATE TABLE and INSERT INTO statements in order to create and populate five tables in...
Write CREATE TABLE and INSERT INTO statements in order to create and populate five tables in Oracle’s SQL*Plus.The information you need about the database ARE IN THE CHARTS BELOW. Each worksheet includes the following information about its associated table: ➢ Column names (for example, the jr_order table contains the orderID, customerID, orderDate, orderStatus, and orderShippedDate columns); ➢ Column data types (for example, orderID is INT, orderStatus is VARCHAR2(2), etc.); ➢ Column constraints, if any (for example, orderID in the jr_order...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns 2.Alter the tables to add the columns 3.Alter the tables to create the primary and foreign keys
Create a table showing the payment of a mortgage of $239,000 month by month. Create columns...
Create a table showing the payment of a mortgage of $239,000 month by month. Create columns for: - Time (in years) - Interest (for that month) - Payment (always the same value) - Payment against principal - Remaining Principal The mortgage is to last 33 years, and the nominal interest rate is 6.03% (a) What is the monthly payment? (b) What is the interest paid at the end of the 9th month? (c) How much of the principal is paid...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT