Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Based on the four tables that are created in the first question, you should stor

ID: 3710978 • Letter: B

Question

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

Please the answer should typing, not scanning or photos

Author_ID

FIRST_NAME

LAST_NAME

111

Ali

Sami

222

Mohammed

Khalid

333

Saad

Ahmed

Explanation / Answer

CREATE TABLE Author
(
Author_ID int NOT NULL,
FIRST_NAME varchar(50) NOT NULL,
LAST_NAME varchar(50) NOT NULL,
PRIMARY KEY (Author_ID)
);

insert into Author values(111,'Ali','Sami');
insert into Author values(222,'Mohammed','Khalid');
insert into Author values(333,'Saad','Ahmed');


mysql> select * from Author;
+-----------+------------+-----------+
| Author_ID | FIRST_NAME | LAST_NAME |
+-----------+------------+-----------+
| 111 | Ali | Sami |
| 222 | Mohammed | Khalid |
| 333 | Saad | Ahmed |

+-----------+------------+-----------+

****************************************************
CREATE TABLE ISBN_Table
(
ISBN int NOT NULL,
Title varchar(50) NOT NULL,
Price float NOT NULL,
Publisher varchar(50) NOT NULL,
Pub_date date NOT NULL,
Edition int NOT NULL,
Pages int NOT NULL,
PRIMARY KEY (ISBN)
);

insert into ISBN_Table values(15111,'Math 1',37.99,'New Math','January 20, 2016',1,256);
insert into ISBN_Table values(16222,'The Art of Strategy',26.94,'AWP','June 21, 2014',3,250);
insert into ISBN_Table values(17222,'Calculus',25,'New Math','January 11, 2017',1,753);
insert into ISBN_Table values(18111,'Game Theory',40.99,'MIT','January 01, 2016',2,333);

mysql> insert into ISBN_Table values(15111,'Graph Theory',100,'John Wiley','January 01, 2018',1,320);
ERROR 1062 (23000): Duplicate entry '15111' for key 1

insert into ISBN_Table values(15112,'Graph Theory',100,'John Wiley','January 01, 2018',1,320);

mysql> select * from ISBN_Table;
+-------+---------------------+-------+------------+------------+---------+-------+
| ISBN | Title | Price | Publisher | Pub_date | Edition | Pages |
+-------+---------------------+-------+------------+------------+---------+-------+
| 15111 | Math 1 | 37.99 | New Math | 0000-00-00 | 1 | 256 |
| 16222 | The Art of Strategy | 26.94 | AWP | 0000-00-00 | 3 | 250 |
| 17222 | Calculus | 25 | New Math | 0000-00-00 | 1 | 753 |
| 18111 | Game Theory | 40.99 | MIT | 0000-00-00 | 2 | 333 |
| 15112 | Graph Theory | 100 | John Wiley | 0000-00-00 | 1 | 320 |
+-------+---------------------+-------+------------+------------+---------+-------+

*****************************************************************************

CREATE TABLE ISBN_AUTHOR
(
ISBN int,
Author_ID int,
FOREIGN KEY (ISBN) REFERENCES ISBN_Table(ISBN),
FOREIGN KEY (Author_ID) REFERENCES Author(Author_ID)
);

insert into ISBN_AUTHOR values(15111,111);
insert into ISBN_AUTHOR values(16222,222);
insert into ISBN_AUTHOR values(17222,222);
insert into ISBN_AUTHOR values(18111,111);
insert into ISBN_AUTHOR values(15111,333);

mysql> select * from ISBN_AUTHOR;
+-------+-----------+
| ISBN | Author_ID |
+-------+-----------+
| 15111 | 111 |
| 16222 | 222 |
| 17222 | 222 |
| 18111 | 111 |
| 15111 | 333 |
+-------+-----------+
5 rows in set (0.00 sec)
*********************************************************************

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote