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

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...
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
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...
Problem 1. Please create the following tables for a tool rental database with appropriate primary keys...
Problem 1. Please create the following tables for a tool rental database with appropriate primary keys & foreign keys. [30 points] Assumptions: Each tool belongs to a category. Each category may have a parent category but the parent category should not have parent category (so at most two levels). E.g., a Tool A belongs to electric mower, and electric mower belongs to mower. Mower has no parent category. Each tool can be rented at different time units. The typical time...
Create a Database Schema for a hotel reservation system. indicate the Primary Keys, Foreign Keys, and...
Create a Database Schema for a hotel reservation system. indicate the Primary Keys, Foreign Keys, and the one-to-one or one-to-many relationships between the tables. Also describe in a small paragraph the scope of the back-end database, by explaining the different tables and their relations in your schema.
Tables: Create table Item(    &nbs... Bookmark Tables: Create table Item(                 ItemId           &nb
Tables: Create table Item(    &nbs... Bookmark Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primary key,                 Decription           varchar2(30),                 Unitcost               number(7,2)); Create table Customer(                 custID                   char(5) constraint cid.unique primary key,                 custName          varchar2(20),                 address                                varchar2(50)); Create table Orderdata( orderID                char(5) constraint oid_uniq primary key,                 orderdate           date,                 shipdate              date,                 ItemId                  char(5) references Item.ItemId,                 No_of_items     number(4),                 Unitcost               number(7,2),                 Order_total        number(7,2),                 custID                   char(5) references customer.custID); Insert Into Item values(‘A123’,’Pencil’,2.5);...
Consider the following relational schema about a University (the primary keys are underlined and foreign keys...
Consider the following relational schema about a University (the primary keys are underlined and foreign keys are italic) STUDENT(StudentID, name, major, year, age) CLASS(ClassName, meetsAt, room, LecturerID) ENROLLED(StudentID, ClassName, mark) LECTURER(LecturerID, name, DepartmentID) DEPARTMENT(DepartmentID, name) Write the SQL statements for the following query: B1. Find the age of the oldest student. B2. Find the ID’s of lecturers whose name begins with “K” \ B3. Find the age of the youngest student who is enrolled in Mechatronics. B4. Find the age...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT