0% found this document useful (0 votes)
63 views2 pages

Bca Lab Practicle

The document contains 10 sets of questions related to SQL and relational database concepts. The questions involve creating tables, inserting data, performing queries using operators like select, count, join etc. and manipulating the structure of tables by adding, deleting columns or renaming them.

Uploaded by

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

Bca Lab Practicle

The document contains 10 sets of questions related to SQL and relational database concepts. The questions involve creating tables, inserting data, performing queries using operators like select, count, join etc. and manipulating the structure of tables by adding, deleting columns or renaming them.

Uploaded by

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

SET A

1. A. Create the following tables with the fields given below:


a. client_master (Name, address1, address2, city, state, pincode, bal_due)
b. Product_master (Product_no, Description, Profit_percent, Unit_measure, Qty_on_hand, Reoder, Sell_price,
Cost_price )
C. Insert the following data into their respective tables
D. Delete duplicate row from the table.
E. Display the alternate row from table..

2. Consider the following database and write SQL as given: (5)


Customer (Cno, Cname, Caddress, Ccontact)
Purchase (Cno,Pid)
Product (Pid, Pname, price, quantity) (5 × 2 = 10)
a. Find the names of all products having price 2000.
b. Find the name of those customers who purchased HP Laptop.
c. Find the total number of products purchased by customer ‘John’

SET B
3. A. Create the following tables with the fields given below:
a. TEACHER (T_ID, Department, Year of Exp, Name)
b. SUBJECT PAPER (Sub_Paper_ID, T_ID, Title_of Paper, Programme, Semester)
B. Insert the following data into their respective tables
C. Delete duplicate row from the table.
D. Display the alternate row from table.

4. Retrieve the TName, and No_of_period of teachers who teach in “ABC” school using Relational Algebra. (5)
TEACHER (TID, TName, TAddress, TQualification)
SCHOOL (SID, SName, SAddress, SPhone)
SCHOOL_TEACHER (SID, TID, No_of Period).

SET C

5. A. Create the following tables with the fields given below:


a. client_master (Name, address1, address2, city, state, pincode, bal_due)
b. Product_master (Product_no, Description, Profit_percent, Unit_measure, Qty_on_hand, Reoder, Sell_price,
Cost_price )
B. Insert the following data into their respective tables
C. On the basis of above two tables answer the following Questionaries:
i. Count the total number of orders
ii. Calculate the average price of all the products.

6. Assume a database about Company. (5)


EMPLOYEE (ss#, name)
COMPANY (cname, address)
WORKS (ss#, cname)
SUPERVISE ( superviser_ss#, employee_ss#)
Write relational algebra and SQL queries for each of the following cases.
 Find the names of all supervisors that work in companies whose address equals ‘pokhara’.
 Find the name of all the companies who have more than 4 supervisors.

SET D
7. A. Create the following tables with the fields given below:
PRODUCT (Product_ID, Supplier ID, Proudct_Nanie, Category, Price, QuantityAvailable)
SUPPLIER (Supplier ID, Name, Area, City)
B. Insert the following data into their respective tables for the tables designed above.
C. Answer the following queries using SQL using above table:
(a) List price and product name of all the products whose Quantity- available is more than 100.
(b) Display product name and category of all the product whose price is more than Rs. 1,000 C.

8. Perform the following: Consider Dept table: (DEPTNO, DNAME, LOC)


Perform the following:
I. Altering a Table, Dropping/Truncating/Renaming Tables,
II. Add a new column PINCODE with not null constraints to the existing table DEPT
III. Rename the column DNAME to DEPT_NAME in dept table Change the data type of column loc as CHAR with
size 10
IV. Delete table
SET E
9. The ACTOR database has a table with the following attributes. The primary keys are underlined.
EMP (ACTno: int, name: string, dob: date, PhNo: int)
I. Create the above table.
II. Display table Structure.
III. Enter five tuples into the table.
IV. Display all the tuples in ACT table.

10. Consider the following employee database, where primary keys are underlined. [5]
employee (employee-name, street, city)
works (employee-name, company-name, salary)
company (company-name, manager-name)
manages (employee-name, manager-name)
Give an expression in SQL for each of the following queries.
a) Find the names of all employees who work for Second Bank Corporation.
b) Find the names, street and cities of residence of all employees who work for Second Bank
Corporation.

You might also like