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

sql

The document outlines the creation and manipulation of several database tables, including Product, Client, Activity, Coach, Customer, Bill, Books, and Issues. It specifies the structure of each table and provides a series of SQL queries to perform various operations such as data insertion, retrieval, and updates. The queries cover tasks like filtering records, calculating aggregates, and modifying table structures.

Uploaded by

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

sql

The document outlines the creation and manipulation of several database tables, including Product, Client, Activity, Coach, Customer, Bill, Books, and Issues. It specifies the structure of each table and provides a series of SQL queries to perform various operations such as data insertion, retrieval, and updates. The queries cover tasks like filtering records, calculating aggregates, and modifying table structures.

Uploaded by

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

INDEX

S.NO. Description Date Sign


1. Create a table Product with following structure: P_ID
char (4) primary key, ProductName varchar (12),
Manufacturer char (3), Price integer, ExpiryDate date.

1. Add 5 records
2. Write queries to do the following:
2.1 To display ProductName, Manufacturer,
ExpiryDate for all products that expired on or
before ‘2010-12-31’
2.2 To display all records with Manufacturer
starting with ‘L’.
2.3 To display all records in descending order
of price.
2.4 To display number of unique ProductName
existing in the table.
2.5 To display average of price, minimum
price, maximum price and count ProductName
wise
2.6 Increase price of products by 10%.
2. Create a table Client with following structure: C_ID
integer (Primary Key), ClientName varchar(15),City
varchar(10),P_ID char(4). Write queries to do the
following:

1. To display C_ID, ClientName, City and


ProductName for all Clients residing in Delhi.
2. To add a field Balance Numeric(8,2) with a
default value 12000.
3. To show C_ID, ClientName and Monthly
Balance(Balance/12).Using aliasing for
MonthlyNbalance.
4. To show records of all clients with ClientName
consisting of 4characters.
5. Delete all records of clients with
City=”Bengaluru”
3. Create the tables ACTIVITY and COACH. Write SQL
commands for the statements (i) to (v):

i. To display the name of all activities with their


Acodes in descending order.
ii. To display sum of PrizeMoney for each of the
Number of participants groupings (as shown in
column ParticipantsNum 10,12,16)
iii. To display the coach’s name, Activity name and
ACodes from the table COACH and ACTIVITY
iv. To display the content of the GAMES table
whose ScheduleDate earlier than 01/01/2004 in
ascending order of ParticipantNum.
v. To display Maximum Schedule date and
Minimum Schedule date from table Activity.
4. Create the tables Customer and Bill. Write SQL
commands for the statements (i) to (v):

i. Display a report containing cust_id, cust_name,


Item, qty, price and bill amount. Bill amount is
calculated as the sum of qty*price.
ii. Display how many customers have ordered
Pizza in the month of August.
iii. Display the name of customer along with their
city in alphabetical order of city.
iv. Insert into table customer a column City and
enter Delhi to all of them.
v. To display how many clients are there in each
city.
5. Create the tables BOOKS and ISSUES and write the
SQL commands for (i) to (v):

i. To show Book name, Author name and Price of


books of ABC publisher.
ii. To display the details of the books in
descending order of their price.
iii. To decrease the Qty_Issued from ISSUES table
by 3 (all rows must decrease).
iv. To display the Book Id, Book name, Publisher,
Price, Qty, Qty_Issued from both the tables with
their matching Book ID.
v. To display the Price of Books where Quantity
Issued is equal to 5.

You might also like