Question

In: Computer Science

1. Write CREATE TABLE statements for the following tables (foreign keys are in italic and bold)....

1. Write CREATE TABLE statements for the following tables (foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes:

Student (stID, stName, dateOfBirth, advID, majorName, GPA)

Advisor (advID, advName, specialty)

2.  Insert several records in each table.

Solutions

Expert Solution

CREATING TABLES :

FOR STUDENT:

CREATE TABLE Student ( stID number(5) , stName varchar2( 20 ) , dateOfBirth date , advId number( 5 ) , majorName varchar2( 30 ) , GPA varchar2(2 , 5 )); // COMMAND FOR CREATING TABLE IN SQL USING CREATE TABLE FOLLOWED BY TABLE NAME AND DATA.

FOR ADVISOR :

CREATE TABLE Advisor (advID number(5) , advName varchar2(30) , speciality varchar2(20) ); // COMMAND FOR CREATING TABLE IN SQL USING CREATE TABLE FOLLOWED BY TABLE NAME AND DATA.

INSERTING SEVERAL RECORDS IN EACH TABLE :

FOR STUDENT TABLE :

  • INSERT INTO Student VALUES (101 , 'VINAY' , 23-11-1999 , 501 , 'VISHAL' , 9.1 ); //COMMAND FOR INSERTING DATA INTO TABLE STUDENT USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Student VALUES (102 , 'KUMAR' , 29-01-1997 , 502 , 'VIMAL' , 9.5 );  //COMMAND FOR INSERTING DATA INTO TABLE STUDENT USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Student VALUES (103 , 'LOKESH' , 13-10-1995 , 503 , 'VIJAY' , 8.3 ); //COMMAND FOR INSERTING DATA INTO TABLE STUDENT USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Student VALUES (104 , 'VISHNU' , 15-08-1993 , 501 , 'SHANMUKH' , 7.5 );  //COMMAND FOR INSERTING DATA INTO TABLE STUDENT USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Student VALUES (105 , 'MOULEE' , 08-04-2000 , 502 , 'CHARAN' , 8.8 );  //COMMAND FOR INSERTING DATA INTO TABLE STUDENT USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .

FOR ADVISOR TABLE :

  • INSERT INTO Advisor VALUES ( 505 , 'SALAM' , 'ARTIFICAIL INTELLIGENCE' );  //COMMAND FOR INSERTING DATA INTO TABLE ADVISOR USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Advisor VALUES ( 504 , 'VENKATESH' , 'MACHINE LEARNING' ); //COMMAND FOR INSERTING DATA INTO TABLE ADVISOR USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Advisor VALUES ( 503 , 'MAHESHWAR RAO' , 'NEURAL NETWORKS' ); //COMMAND FOR INSERTING DATA INTO TABLE ADVISOR USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Advisor VALUES ( 502 , 'JAY KRISHNA' , 'CLOUD COMPUTING' ); //COMMAND FOR INSERTING DATA INTO TABLE ADVISOR USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .
  • INSERT INTO Advisor VALUES ( 501 , 'JAY RAM' , 'BIG DATA' );   //COMMAND FOR INSERTING DATA INTO TABLE ADVISOR USING INSERT INTO TABLE NAME FOLLOWED BY VALYUES FOR DATA COLUMNS .

Related Solutions

1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are...
1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes: Student (stID, stName, dateOfBirth, advID, majorName, GPA) Advisor (advID, advName, specialty) 2.  Insert several records in each table.
1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are...
1. Write CREAT TABLE statements for the following tables (primary keys are underlined, foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes: Student (stID, stName, dateOfBirth, advID, majorName, GPA) Advisor (advID, advName, specialty) 2. Insert several records in each table.
Create the following tables. The underlined bold column names are the primary keys. Make sure to...
Create the following tables. The underlined bold column names are the primary keys. Make sure to specify the primary and foreign key constraints in your create table statements. customer: (cus_code:integer, cus_lname:varchar(20), cus_fname:varchar(20), cus_initial:char, cus_areacode:integer,cus_phone:integer). invoice: (inv_number:integer, cus_code:integer, inv_date:date,                   foreign key cus_code references customer(cus_code)) vendor:(vend_code:integer,vend_name:varchar(30),vend_contact:varchar(30),vend_areacode:integer,vend_phone:integer) product:(prod_code:integer, prod_desc:varchar(50), prod_price:integer, prod_quant:integer,vend_code:integer, foreign key (vend_code) referenecs Vendor(vend_code)) line: (inv_number:integer, prod_code:integer ,line_units:integer, foreign key (inv_number) references Invoice(inv_number), foreign key (prod_code) references Product (prod_code) )
1. write SQL statements to create the following two tables: a) Department table that contains the...
1. write SQL statements to create the following two tables: a) Department table that contains the following columns(dept_no,deptname,location) set the deptno to be the primary key. b) Employee table contains the following columns(emp_no,empname,deptno,salary)set the emp_no to be the primary key and dept_no to be the foreign key. 2. Write SQL statements to Insert the following 3 rows in Employee table:        (101,’Sami’,’D-101’,5000)        (102,’Yousef’,’D-101’,4000)        (103,’Sami’,’D-102’,7000) 3. Write SQL statements to Insert the following 3 rows in Department table:       ...
Please create the following tables for a tool rental database with appropriate primary keys & foreign...
Please create the following tables for a tool rental database with appropriate primary keys & foreign keys. Assumptions: 1. Each tool belongs to a category. 2. Each category may have a parent category but the parent category should not have a parent category (so at most two levels). E.g., a Tool A belongs to the electric mower, and electric mowers belong to mowers. Mower has no parent category. 3. Each tool can be rented at different time units. The typical...
Consider the following three tables, primary and foreign keys. Table Name        SalesPeople Attribute Name                  &nbsp
Consider the following three tables, primary and foreign keys. Table Name        SalesPeople Attribute Name                                Type                                      Key Type EmployeeNumber             Number                               Primary Key Name                                   Character JobTitle                                  Character            Address                                 Character PhoneNumber                     Character YearsInPosition                             Number Table Name        ProductDescription Attribute Name                                Type                                      Key Type                 ProductNumber                Number                               Primary Key                 ProductName                  Character                            ProductPrice                   Number Table Name        SalesOrder Attribute Name                                Type                                      Key Type                 SalesOrderNumber        Number                               Primary Key                 ProductNumber               Number                               Foreign Key                 EmployeeNumber           Number                               Foreign Key                 SalesOrderDate                Date Assume that you...
Consider the following three tables, primary and foreign keys. Table Name        SalesPeople Attribute Name                  &nbsp
Consider the following three tables, primary and foreign keys. Table Name        SalesPeople Attribute Name                                Type                                      Key Type EmployeeNumber             Number                               Primary Key Name                                   Character JobTitle                                  Character            Address                                 Character PhoneNumber                     Character YearsInPosition                             Number Table Name        ProductDescription Attribute Name                                Type                                      Key Type                 ProductNumber                Number                               Primary Key                 ProductName                  Character                            ProductPrice                   Number Table Name        SalesOrder Attribute Name                                Type                                      Key Type                 SalesOrderNumber        Number                               Primary Key                 ProductNumber               Number                               Foreign Key                 EmployeeNumber           Number                               Foreign Key                 SalesOrderDate                Date Assume that you...
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...
Write create table statements to create tables for the Exoproduct employees computers database depicted by the...
Write create table statements to create tables for the Exoproduct employees computers database depicted by the relational schema created in a mini case MC5 in chapter 3. Use insert into statements to insert no fewer than 2 and no more than 10 records per table.
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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT