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

GE Practical CS

The document describes creating and populating multiple database tables to store library, student, bicycle, employee, and supplier data. It provides examples of primary keys, foreign keys, and queries to retrieve, update, and analyze the data. Several tasks are listed to manipulate the data in the tables.

Uploaded by

manickamnilesh4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

GE Practical CS

The document describes creating and populating multiple database tables to store library, student, bicycle, employee, and supplier data. It provides examples of primary keys, foreign keys, and queries to retrieve, update, and analyze the data. Several tasks are listed to manipulate the data in the tables.

Uploaded by

manickamnilesh4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

PRACTICAL - 1

Create a Database having following tables with the specified fields, to computerize a library
system of a Delhi university college:

Library_Books (Accession_Number, Title, Author, Department, Purchase_Date, Price)


Issued_Books (Accession_Number, Borrower)

1. Identify Primary and Foreign Keys. Create the tables and insert following records in each
table.

Accession Title Author Department Purchase Price


Number Date
A101 Database Navathe CS 03/03/2001 750
System
Concepts
A102 Probability Diestel Maths 02/01/1999 500
Theory
A103 Discrete Rosen Maths 13/08/2002 350
Mathematics
A104 C++ Lafore CS 20/05/2001 550
Programming
A105 Web Navathe CS 24/09/2004 400
Designing

Accession Number Borrower


A102 Alice
A105 Bruna
A104 Edward
A105 Kiara
A103 John

2. Delete the record of the book titled “Database System Concepts”.


3. Change the department of the book titled “Discrete Maths to “CS”.
4. List all books that belong to “CS” department.
5. List all books that belong to “CS” department and written by author “Navathe”.
6. List all books (Department = “CS”) that have been issued.
7. List all books which have a price less than 500 or purchased between “01/01/1999” and
“01/01/2004.
PRACTICAL - 2

Create a Database having following tables to store the details of students of computer
science department in your college:

Student_Personal_Information(College_Roll_No, Student_Name, Date_Of_Birth, Address,


Marks_In_12th, Phone_Number)
Paper_Details(Paper_Code, Paper_Name)
Student_Academic_Details(College_Roll_No, Paper_Code, Attendance, Exam_Marks)

1. Identify Primary and Foreign Keys. Create the tables and insert following records in each
table.
College Student Date Of Address Marks Phone No
Roll No Name Birth In 12th
15101 Kiara 15/01/2000 Delhi 90 9891309874
15102 Lucy 22/05/1999 Jaipur 85 9911729278
15103 Edward 09/12/2000 Kerala 92 9562091819
15104 John 03/10/1998 Delhi 96 8560272305
15105 Alice 24/09/1999 Bangalore 87 9871642090

Paper_Code Paper_Name
101 Paper1
102 Paper2
103 Paper3
104 Paper4
105 Paper5

College Paper Attendance Exam


Roll No Code Marks
15101 101 75 80
15101 102 80 92
15102 103 60 85
15102 105 65 76
15103 101 72 90
15103 105 70 73
15104 101 66 75
15104 104 80 87
15105 102 82 95
15105 103 55 72

2. Design a query that will return the records (from the second table) along with the name of
the student from the first table, related to students who have more than 75% attendance
and more than 60% marks in paper 2.
3. List all students who live in “Delhi” and have marks greater than 60 in paper 1.
4. Find the total attendance and total marks obtained by each student.
5. List the name of student who has got the highest marks in paper 2.
PRACTICAL - 3

Create the following tables:

Customer (Cust_ID, Email, Phone, Reference_ID)


Bicycle (Bicycle_ID, Date_Purchased, Color, Cust_ID, Model_No)
Bicycle_Model (Model_No, Manufacturer, Style)
Service (Start_Date, Bicycle_ID, End_Date)

1. Identify the Primary and Foreign Keys. Create the tables and insert following records in
each table.
Cust_ID Email Phone Reference_ID
C101 [email protected] 9891309874 C105
C102 [email protected] 9911729278 C101
C103 [email protected] 9562091819 C101
C104 [email protected] 8560272305 C104
C105 [email protected] 9871642090 C102

Bicycle_ID Date_Purchased Color Cust_ID Model_No


B101 12/11/2010 Red C101 M104
B102 17/04/2012 Blue C104 M101
B103 08/03/2009 Red C102 M104
B104 04/12/2015 Black C105 M103
B105 20/12/2014 Red C103 M102

Model_No Manufacturer Style


M101 Hero Mountain
M102 Bajaj Hybrid
M103 Hero BMX
M104 Honda Folding
M105 Honda Tandem

Start_Date Bicycle_ID End_Date


19/12/2012 B101 23/12/2012
05/12/2016 B104 09/12/2016
20/12/2015 B105 26/12/2015
08/05/2011 B103 12/05/2011
19/06/2014 B102 25/06/2014

2. List all the customers who have the bicycles manufactured by manufacturer “Honda”.
3. List the bicycles purchased by the customers who have been referred by customer
“C101”.
4. List the manufacturer of red colored bicycles.
5. List the models of the bicycles given for service.
PRACTICAL - 4

Create the following tables:

Employee (Person_Name, Street, City) , Works (Person_Name, Company_Name, Salary)


Company (Company_Name, City), Manages (Person_Name, Manager_Name)

1. Identify the Primary and Foreign Keys. Create the tables and insert following records in
each table.
Person_Name Street City
Lucy Laxmi Nagar Delhi
Kiara Hauz Khaz Bombay
Edward Saket Chennai
Alice Dwarka Bangalore
Justin Karol Bagh Hyderabad
Reva Windsor Street Manglore
John Jor Bagh Pune
Shailly Okhla Bombay

Person_Name Company_Name Salary


Lucy Samba Bank 20,000
Kiara PWC 18,000
Edward Samba Bank 12,000
Lucy NCB Bank 24,000
Justin E&Y 15,000
Alice Delloite 18,000
Edward NCB Bank 10,000
Reva Axis Bank 12,000
John ONGC 20,000
Shailly NTPC 25,000

Company_Name City
Samba Bank Chennai
PWC Bombay
NCB Bank Pune
E&Y Hyderabad
Delloite Manglore
Axis Bank Delhi
ONGC Bombay
NTPC Bangalore

Person_Name Manager_Name
Kiara Edward
Justin Reva
Alice Shailly
Kiara Lucy
Alice John
2. Alter table employee, add a column “email” of type Varchar (20).
3. Find the names of all managers who work for both Samba bank and NCB bank.
4. Find the names, street address and cities of residence and salary of employees who work
for “Samba Bank” and earn more than $10,000.
5. Find the names of all employees who live in the same city as the company for which they
work.
6. Find the highest salary, lowest salary and average salary paid by each company.
7. Find the sum of salary and the number of employees in each company.
8. Find the name of the company that pays highest salaries.
PRACTICAL - 5

Create the following tables:

Supplier(S_No, S_Name, Status, S_City), Parts(P_No, P_Name, Color, Weight, City)


Project(J_No, J_Name, J_City), Shipment(S_No, P_No, J_No, Quantity)

1. Identify the Primary and Foreign Keys. Create the tables and insert following records in
each table.
S_No S_Name Status S_City
S1 David & Co. 25 London
S2 Bruna & Co. 35 Paris
S3 Bansal & Co. 4 Delhi
S4 Swastik & Co. 20 Chennai
S5 Edward & Co. 15 London

P_No P_Name Color Weight City


P1 Forks Red 15 Paris
P2 Derailleurs Grey 18 Chennai
P3 Cranksets Red 20 London
P4 Handlebars Blue 14 London
P5 Cleats Red 10 Delhi

J_No J_Name J_City


PT1 Amber City Dubai
PT2 Parshvnath Delhi
PT3 Ambience City London
PT4 Sun City Canada
PT5 Mahagun London

S_No P_No J_No Quantity


S1 P1 PT1 300
S1 P3 PT2 400
S1 P4 PT3 350
S2 P3 PT4 450
S2 P2 PT2 500
S3 P1 PT1 470
S3 P3 PT5 650
S4 P4 PT1 700
S4 P2 PT1 750
S5 P2 PT5 800
S5 P5 PT3 450

2. Get supplier number of suppliers in Paris with status>20.


3. Get suppliers details for suppliers who supply part P2. Display list in increasing order of
supplier numbers.
4. Get supplier names for suppliers who do not supply part P2.
5. For each shipment, get full shipment details, including total shipment weights.
6. Get all the shipments where the quantity is in the range of 300 to 750 inclusive.
7. Get part numbers for parts that either weigh more than 16 pounds or are supplied by
suppliers S2, or both.
8. Get the names of cities that store (i.e., status) more than five red parts.
9. Get full details of parts supplied by a supplier in London.
10. Get part numbers for parts supplied by a supplier in London to a project in London.
11. Get the total number of projects supplied by a supplier.
12. Get the total quantity of each part supplied by each supplier.

You might also like