0% found this document useful (0 votes)
4 views

SQLEXERCISE3.1

Uploaded by

kyimdeleon1203
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

SQLEXERCISE3.1

Uploaded by

kyimdeleon1203
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

1. Use the appropriate CREATE TABLE commands to create the tables in the Henry Books database.

Coding: USE Henry_Book


CREATE Database Henry_Book; CREATE TABLE Book
(Book_Code char(15) Primary Key,
USE Henry_Book Title char(60),
CREATE TABLE Branch Publisher_Code char(15),
(Branch_Num int IDENTITY (1,1) Type_ char(15),
Primary Key, Price_ char(15),
Branch_Name char(30), Paperback_ char(15));
Branch_Location char(30),
Num_Employees char(15)); USE Henry_Book
CREATE TABLE Wrote
USE Henry_Book (Book_Code char(15) ,
CREATE TABLE Publisher Author_Num char (15),
(Publisher_Code char(15) Primary Key, Sequence_ char(15)
Publisher_Name char (60), CONSTRAINT PK_Wrote Primary Key
City char(30)); (Book_Code, Author_Num));

USE Henry_Book USE Henry_Book


CREATE TABLE Author CREATE TABLE Inventory
(Author_Num int IDENTITY (1,1) (Book_Code char(15) ,
Primary Key, Branch_Num char (15),
Author_Last char(30), OnHand_ char(15)
Author_First char(30)); CONSTRAINT PK_Inventory Primary
Key (Book_Code, Branch_Num));
2. Add the branch information to the BRANCH table using INSERT commands.

Coding:
INSERT INTO Branch (Branch_Name, VALUES ('Henry Bentwood', 'Brentwood
Branch_Location, Num_Employees) Mall', '15');
VALUES ('Henry Downtown', '16 INSERT INTO Branch (Branch_Name,
Riverview', '10'); Branch_Location, Num_Employees)
INSERT INTO Branch (Branch_Name, VALUES ('Henry Eastshore', 'Eastshore
Branch_Location, Num_Employees) Mall', '9');
VALUES ('Henry On The Hill', '1289 SELECT * FROM Branch;
Bedford', '6');
INSERT INTO Branch (Branch_Name,
Branch_Location, Num_Employees)

3. Add the publisher information to the PUBLISHER table.


Coding: INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('BY', 'Back Bay Books', 'New
VALUES ('AH', 'Arkham House', 'Sauk York');
City WI'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('CT', 'Course Technology',
VALUES ('AP', 'Arcade Publishing', 'Cambridge MA');
'New York'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('FA', 'Fawcett Books', 'New
VALUES ('BA', 'Basic Books', 'Boulder York');
CO'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES('FS', 'Farrar Straus and
VALUES ('BP', 'Berkley Publishing', Giroux', 'New York');
'Boston');
INSERT INTO Publisher INSERT INTO Publisher
(Publisher_Code, Publisher_Name, (Publisher_Code, Publisher_Name,
City) City)
VALUES ('HC', 'HarperCollins VALUES ('SB', 'Schocken Books', 'New
Publishers', 'New York'); York');
INSERT INTO Publisher INSERT INTO Publisher
(Publisher_Code, Publisher_Name, (Publisher_Code, Publisher_Name,
City) City)
VALUES ('JP', 'Jove Publications', 'New VALUES ('SC', 'Scribner', 'New York');
York'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('SS', 'Simon and Schuster',
VALUES ('JT', 'Jeremy P. Tarcher', 'Los 'New York');
Angeles'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('ST', 'Scholastic Trade', 'New
VALUES ('LB', 'Lb Books', 'New York');
York'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('TA', 'Taunton Press',
VALUES ('MP', 'McPherson and Co.', 'Newtown CT');
'Kingston'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('TB', 'Tor Books', 'New
VALUES ('PE', 'Penguin USA', 'New York');
York'); INSERT INTO Publisher
INSERT INTO Publisher (Publisher_Code, Publisher_Name,
(Publisher_Code, Publisher_Name, City)
City) VALUES ('TH', 'Thames and Hudson',
VALUES ('PL', 'Plume', 'New York'); 'New York');
INSERT INTO Publisher INSERT INTO Publisher
(Publisher_Code, Publisher_Name, (Publisher_Code, Publisher_Name,
City) City)
VALUES ('PU', 'Putnam Publishing VALUES ('TO', 'Touchstone Books',
Group', 'New York'); 'Westport CT');
INSERT INTO Publisher INSERT INTO Publisher
(Publisher_Code, Publisher_Name, (Publisher_Code, Publisher_Name,
City) City)
VALUES ('RH', 'Random House', 'New VALUES ('VB', 'Vintage Books', 'New
York'); York');
INSERT INTO Publisher VALUES ('WP', 'Westview Press',
(Publisher_Code, Publisher_Name, 'Boulder CO');
City) SELECT * FROM Publisher;
VALUES ('WN', 'W.W. Norton', 'New
York');
INSERT INTO Publisher
(Publisher_Code, Publisher_Name,
City)
4. Add the author information to the AUTHOR table.

Coding:
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Morrison', 'Toni'); VALUES ('Straub', 'Peter');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Solotaroff', 'Paul'); VALUES ('King', 'Stephen');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Vintage', 'Vernor'); VALUES ('Pratt', 'Philip');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Francis', 'Dick'); VALUES ('Chase', 'Truddi');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Collins', 'Bradley'); VALUES ('Camus', 'Albert');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Heller', 'Joseph'); VALUES ('Collins, Jr.', 'Bradley');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Wills', 'Gary'); VALUES ('Steinbeck', 'John');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Hofstadter', 'Douglas R.'); VALUES ('Castelman', 'Riva');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Lee', 'Harper'); VALUES ('Owen', 'Barbara');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Ambrose', 'Stephen E.'); VALUES ('O’Rourke', 'Randy');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Rowling', 'J.K.'); VALUES ('Kidder', 'Tracy');
INSERT INTO Author (Author_Last, INSERT INTO Author (Author_Last,
Author_First) Author_First)
VALUES ('Salinger', 'J.D.'); VALUES ('Schleining', 'Lon');
INSERT INTO Author (Author_Last, SELECT * FROM Author
Author_First)
VALUES ('Heaney', 'Seamus');

5. Add the book information to the BOOK table. In the PAPERBACK column, enter Y where the
entry is Yes and N where the entry is No.
Coding:
INSERT INTO Book (Book_Code, VALUES ('0378', 'Venice', 'SS', 'ART',
Title, Publisher_Code, Type_, Price_, '24.50', 'N');
Paperback_) INSERT INTO Book (Book_Code,
VALUES ('0180', 'A Deepness in the Title, Publisher_Code, Type_, Price_,
Sky', 'TB', 'SFI', '7.19', 'Y'); Paperback_)
INSERT INTO Book (Book_Code, VALUES ('079X', 'Second Wind', 'PU',
Title, Publisher_Code, Type_, Price_, 'MYS', '24.95', 'N');
Paperback_) INSERT INTO Book (Book_Code,
VALUES ('0189', 'Magic Terror', 'FA', Title, Publisher_Code, Type_, Price_,
'HOR', '7.99', 'Y'); Paperback_)
INSERT INTO Book (Book_Code, VALUES ('0808', 'The Edge', 'JP',
Title, Publisher_Code, Type_, Price_, 'MYS', '6.99', 'Y');
Paperback_) INSERT INTO Book (Book_Code,
VALUES ('0200', 'The Stranger', 'VB', Title, Publisher_Code, Type_, Price_,
'FIC', '8.00', 'Y'); Paperback_)
INSERT INTO Book (Book_Code, VALUES ('1351', 'Dreamcatcher: A
Title, Publisher_Code, Type_, Price_, Novel', 'SC', 'HOR', '19.60', 'N');
Paperback_)
INSERT INTO Book (Book_Code, INSERT INTO Book (Book_Code,
Title, Publisher_Code, Type_, Price_, Title, Publisher_Code, Type_, Price_,
Paperback_) Paperback_)
VALUES ('1382', 'Treasure Chests', 'TA', VALUES ('3906', 'The Soul of a New
'ART', '24.46', 'N'); Machine', 'BY', 'SCI', '11.16', 'Y');
INSERT INTO Book (Book_Code, INSERT INTO Book (Book_Code,
Title, Publisher_Code, Type_, Price_, Title, Publisher_Code, Type_, Price_,
Paperback_) Paperback_)
VALUES ('138X', 'Beloved', 'PL', 'FIC', VALUES ('5163', 'Travels with Charley',
'12.95', 'Y'); 'PE', 'TRA', '7.95', 'Y');
INSERT INTO Book (Book_Code, INSERT INTO Book (Book_Code,
Title, Publisher_Code, Type_, Price_, Title, Publisher_Code, Type_, Price_,
Paperback_) Paperback_)
VALUES ('2226', 'Harry Potter and the VALUES ('5790', 'Catch-22', 'SC', 'FIC',
Prisoner of Azkaban', 'ST', 'SFI', '13.96', '12.00', 'Y');
'N'); INSERT INTO Book (Book_Code,
INSERT INTO Book (Book_Code, Title, Publisher_Code, Type_, Price_,
Title, Publisher_Code, Type_, Price_, Paperback_)
Paperback_) VALUES ('6128', 'Jazz', 'PL', 'FIC',
VALUES ('2281', 'Van Gogh and '12.95', 'Y');
Gauguin', 'WP', 'ART', '21.00', 'N'); INSERT INTO Book (Book_Code,
INSERT INTO Book (Book_Code, Title, Publisher_Code, Type_, Price_,
Title, Publisher_Code, Type_, Price_, Paperback_)
Paperback_) VALUES ('6328', 'Band of Brothers',
VALUES ('2766', 'Of Mice and Men', 'TO', 'HIS', '9.60', 'Y');
'PE', 'FIC', '6.95', 'Y'); INSERT INTO Book (Book_Code,
INSERT INTO Book (Book_Code, Title, Publisher_Code, Type_, Price_,
Title, Publisher_Code, Type_, Price_, Paperback_)
Paperback_) VALUES ('669X', 'A Guide to SQL',
VALUES ('2908', 'Electric Light', 'FS', 'CT', 'CMP', '37.95', 'N');
'POE', '14.00', 'N'); INSERT INTO Book (Book_Code,
INSERT INTO Book (Book_Code, Title, Publisher_Code, Type_, Price_,
Title, Publisher_Code, Type_, Price_, Paperback_)
Paperback_) VALUES ('6980', 'Franny and Zooey',
VALUES ('3350', 'Group: Six People in 'LB', 'FIC', '5.99', 'Y');
Search of a Life', 'BP', 'PSY', '10.40', INSERT INTO Book (Book_Code,
'Y'); Title, Publisher_Code, Type_, Price_,
INSERT INTO Book (Book_Code, Paperback_)
Title, Publisher_Code, Type_, Price_, VALUES ('7405', 'East of Eden', 'PE',
Paperback_) 'FIC', '12.95', 'Y');
VALUES ('3743', 'Nine Stories', 'LB', INSERT INTO Book (Book_Code,
'FIC', '5.99', 'Y'); Title, Publisher_Code, Type_, Price_,
Paperback_)
VALUES ('7443', 'Harry Potter and the VALUES ('9627', 'Song of Solomon',
Goblet of Fire', 'ST', 'SFI', '18.16', 'N'); 'PL', 'FIC', '14.00', 'Y');
INSERT INTO Book (Book_Code, INSERT INTO Book (Book_Code,
Title, Publisher_Code, Type_, Price_, Title, Publisher_Code, Type_, Price_,
Paperback_) Paperback_)
VALUES ('7559', 'The Fall', 'VB', 'FIC', VALUES ('9701', 'The Grapes of Wrath',
'8.00', 'Y'); 'PE', 'FIC', '13.00', 'Y');
INSERT INTO Book (Book_Code, INSERT INTO Book (Book_Code,
Title, Publisher_Code, Type_, Price_, Title, Publisher_Code, Type_, Price_,
Paperback_) Paperback_)
VALUES ('8092', 'Godel, Escher, Bach', VALUES ('9882', 'Slay Ride', 'JP',
'BA', 'PHI', '14.00', 'Y'); 'MYS', '6.99', 'Y');
INSERT INTO Book (Book_Code, INSERT INTO Book (Book_Code,
Title, Publisher_Code, Type_, Price_, Title, Publisher_Code, Type_, Price_,
Paperback_) Paperback_)
VALUES ('8720', 'When Rabbit Howls', VALUES ('9883', 'The Catcher in the
'JP', 'PSY', '6.29', 'Y'); Rye', 'LB', 'FIC', '5.99', 'Y');
INSERT INTO Book (Book_Code, INSERT INTO Book (Book_Code,
Title, Publisher_Code, Type_, Price_, Title, Publisher_Code, Type_, Price_,
Paperback_) Paperback_)
VALUES ('9611', 'Black House', 'RH', VALUES ('9931', 'To Kill a
'HOR', '18.81', 'N'); Mockingbird', 'HC', 'FIC', '18.00', 'N');
INSERT INTO Book (Book_Code, SELECT * FROM Book
Title, Publisher_Code, Type_, Price_,
Paperback_)

6. Add the author and the book information to the WROTE table.
INSERT INTO Wrote (Book_Code, VALUES ('138X', '1', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('0180', '3', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('2226', '15', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('0189', '5', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('2281', '9', '2');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('0200', '18', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('2281', '19', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('0378', '11', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('2766', '20', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('079X', '4', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('2908', '17', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('0808', '4', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('3350', '2', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('1351', '6', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('3743', '16', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('1382', '23', '2'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('3906', '24', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('1382', '25', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('5163', '20', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('5790', '10', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('8720', '8', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('6128', '1', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('9611', '5', '2');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('6328', '14', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('9611', '6', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('669X', '7', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('9627', '1', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('6908', '16', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('9701', '20', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('7405', '20', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('9882', '4', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('7443', '15', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('9883', '16', '1');
Author_Num, Sequence_) INSERT INTO Wrote (Book_Code,
VALUES ('7559', '18', '1'); Author_Num, Sequence_)
INSERT INTO Wrote (Book_Code, VALUES ('9931', '13', '1');
Author_Num, Sequence_) SELECT * FROM Wrote;
VALUES ('8092', '12', '1');
7. Add the inventory information to the INVENTORY table.
Coding: INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('079X', '2', '1');
VALUES ('0180', '1', '2'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('079X', '4', '3');
VALUES ('0189', '2', '2'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('0808', '2', '1');
VALUES ('0200', '1', '1'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('1351', '2', '4');
VALUES ('0200', '2', '3'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('1351', '3', '2');
VALUES ('0378', '3', '2'); INSERT INTO Inventory (Book_Code,
Branch_Num, OnHand_)
VALUES ('1382', '2', '1'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('6128', '3', '3');
VALUES ('138X', '2', '3'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('6328', '2', '2');
VALUES ('2226', '3', '2'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('669X', '1', '1');
VALUES ('2226', '4', '1'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('6908', '2', '2');
VALUES ('2281', '4', '3'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('7405', '3', '2');
VALUES ('2766', '3', '2'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('7443', '4', '1');
VALUES ('2908', '1', '3'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('7559', '2', '2');
VALUES ('2908', '4', '1'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('8092', '3', '1');
VALUES ('3350', '1', '2'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('8720', '1', '3');
VALUES ('3743', '2', '1'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('9611', '1', '2');
VALUES ('3906', '2', '1'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('9627', '3', '5');
VALUES ('3906', '3', '2'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('9627', '4', '2');
VALUES ('5163', '1', '1'); INSERT INTO Inventory (Book_Code,
INSERT INTO Inventory (Book_Code, Branch_Num, OnHand_)
Branch_Num, OnHand_) VALUES ('9701', '1', '2');
VALUES ('5790', '4', '2');
INSERT INTO Inventory (Book_Code, INSERT INTO Inventory (Book_Code,
Branch_Num, OnHand_) Branch_Num, OnHand_)
VALUES ('9701', '2', '3'); VALUES ('9883', '2', '3');
INSERT INTO Inventory (Book_Code, INSERT INTO Inventory (Book_Code,
Branch_Num, OnHand_) Branch_Num, OnHand_)
VALUES ('9701', '3', '3'); VALUES ('9883', '4', '2');
INSERT INTO Inventory (Book_Code, INSERT INTO Inventory (Book_Code,
Branch_Num, OnHand_) Branch_Num, OnHand_)
VALUES ('9701', '4', '2'); VALUES ('9931', '1', '2');
INSERT INTO Inventory (Book_Code, SELECT * FROM Inventory
Branch_Num, OnHand_)
VALUES ('9882', '3', '3');

8. List the name of each publisher that is located in New York.

Coding:
USE Henry_Book;
SELECT Publisher_Name
FROM Publisher
WHERE City = 'New York';
9. List the name of each branch that has at least nine employees.
Coding:
USE Henry_Book;
SELECT Branch_Name
FROM Branch
WHERE CAST(Num_Employees AS INT) >= 9;
10. List the branch number and name with the at most 11 employees.

Coding: USE Henry_Book;


SELECT Branch_Num, Branch_Name
FROM Branch
WHERE CAST(Num_Employees AS INT) <= 11;

You might also like