Assignment
Assignment
SYBCA SEM-III
Riya Yadav
Ans)
CREATE TABLE `book` (‘Acc_no’ primary key,
‘P_year’ VARCHAR(50),
‘Title’ VARCHAR(50),
‘Price’ VARCHAR(50) );
INSERT INTO `book` (`Acc_no`, `P_year`, `Title`, `Price`) VALUES ('A101', '1982', 'Software
Testing', '499');
INSERT INTO `book` (`Acc_no`, `P_year`, `Title`, `Price`) VALUES ('A102', '1995', 'Database
System', '729');
INSERT INTO `book` (`Acc_no`, `P_year`, `Title`, `Price`) VALUES ('A103', '1990', 'Compiler', '399');
INSERT INTO `book` (`Acc_no`, `P_year`, `Title`, `Price`) VALUES ('A104', '1991', 'Introduction to
Algorithm', '550');
INSERT INTO `book` (`Acc_no`, `P_year`, `Title`, `Price`) VALUES ('A105', '1989', 'Data
Structures', '350');
Ans )
SELECT * FROM `book`
Acc_no P_year Title Price
P_year Title
1990 Compiler
Ans)
SELECT `Price` FROM `book`;
Price
499
729
399
550
350
Q) Display the details of the book when the price is the greater than 499.
Ans)
SELECT * FROM `book` WHERE price>499;
Q) List all the title mad account number of the “book” relation.
Ans)
SELECT `Acc_no`,`Title` FROM `book`;
Acc_no Title
A101 Software Testing
A103 Compiler
A104 Introduction to
Algorithm
Q) List the title of the book whose price is greater the 550.
a) SELECT `Title` FROM `book` WHERE price>550;
Title
Database System
Q2) Create two table of ypur own with two column and five records and perform the following
A) Divison operator
B) Union operator
C) Intersect operator
D) Difference operator
E) Cartesian product
Ans)
A) Divison operator
B) Union operator
Ans)
SELECT * FROM books UNION SELECT * FROM reviews
C) Intersect operator
D) Difference operator
E) Cartesian product