Course Fundamental Databases (IT403) Q: Based on the four tables that are create
ID: 3715834 • Letter: C
Question
Course Fundamental Databases (IT403)
Q: Based on the four tables that are created in the first question, you should store (insert) the following data using SQL statements:
Author_ID
FIRST_NAME
LAST_NAME
111
Ali
Sami
222
Mohammed
Khalid
333
Saad
Ahmed
ISBN
Author_ID
15111
111
16222
222
17222
222
18111
111
15111
333
ISBN
Title
Price
publisher
Pub_date
Edition
Pages
15111
Math 1
37.99
New Math
January 20, 2016
1
256
16222
The Art of Strategy
26.94
AWP
June 21, 2014
3
250
17222
Calculus
25
New Math
January 11, 2017
1
753
18111
Game Theory
40.99
MIT
January 01, 2016
2
333
15111
Graph Theory
100
John Wiley
January 01, 2018
1
320
Author_ID
FIRST_NAME
LAST_NAME
111
Ali
Sami
222
Mohammed
Khalid
333
Saad
Ahmed
Explanation / Answer
create table Author( AUTHOR_ID numeric(4,0),FIRST_NAME varchar(30), LAST_NAME VARCHAR(30), primary key( AUTHOR_ID) );
insert into Author values (111,'Ali ','Sami') ;
insert into Author values (222,'Mohemmad ','Khalid') ;
insert into Author values (111,'Saad ','Ahmed') ;
create table Book(ISBN int, Title varchar(30), Price numeric(5,2),publisher varchar(40), Pub_date date, Edition int, Pages int, primary key(ISBN));
insert into Book values(15111, 'MATH 1', 37.99, 'New Math', 'January 20 2016',1, 256);
insert into Book values(16222, 'The Art of Strategy', 26.94, 'AWP', 'June 21 2014',3, 250);
insert into Book values(17222, 'Calculus', 25, 'New Math', 'January 11 2017',1, 753);
insert into Book values(18111, 'Game Theory', 40.99, 'MIT', 'January 01 2016',2, 333);
insert into Book values(15111, 'Graph Theory', 100, 'John willy', 'January 01 2018',1, 320);
// can not inserted due ISBN(PK) if there is no PK then no issues
Insert into tablename values (15111,111);
Insert into tablename values (16222,222);
Insert into tablename values (17222,222);
Insert into tablename values (18111,111);
Insert into tablename values (15111,333);
//kindly replace the tablename with actual table name.