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

SQL Practical Lab File

The document outlines practical SQL exercises for B.C.A. III Semester students at S. S. Jain Subodh P. G. College. It includes tasks such as creating tables for Library, Publisher, Student, and Employee databases, inserting records, and performing various SQL queries for data manipulation and retrieval. Students are instructed to document their work in a practical file with specific formatting requirements.

Uploaded by

hridal9521
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)
2 views2 pages

SQL Practical Lab File

The document outlines practical SQL exercises for B.C.A. III Semester students at S. S. Jain Subodh P. G. College. It includes tasks such as creating tables for Library, Publisher, Student, and Employee databases, inserting records, and performing various SQL queries for data manipulation and retrieval. Students are instructed to document their work in a practical file with specific formatting requirements.

Uploaded by

hridal9521
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

S. S. Jain Subodh P. G.

College
B.C.A. III Semester
SQL Practical Lab File

NOTE:-Write your Name, Roll No, Class, Section, Subject with Paper Code on first page of
Practical File. Prepare an Index (S. No, Name of Query, Date, Page No, Remarks) on
second Page of Practical File.

Q1. Create a table Library with the following fields:-

Book_No number (4) primary key


Book_Title varchar2 (20) NOT NULL
Author varchar2 (20)
Purchase_Date date
Price number (4)
Publisher_Id number (5) { Referential key of table Publisher}

Also create a table Publisher:-

Publisher_Id number (5) { Primary Key}


Publisher_Name varchar2 (30)

1) After creating both the tables inserts 5 records in each table.


2) Make a query to display all the rows having price>500.
3) Display only book_no and publisher_id for all rows using “Book” and “Publisher” as column
heading.
4) Delete all the rows in which Book_title is starting with alphabet ‘D’.
5) Update price, increase it by 10% for book_title="Database".
6) Make a query to display the Book Title, Author Name and Publisher name.
7) Display all the rows in descending order of Book Title for price>400 and <700.

Q2. Create a table Student as given below:-


Student_No number (5) Primary Key
Name varchar2 (20) NOT NULL
Class char (6)
Marks number (3)
1) After creating the table inserts 5 records.
2) Display the average marks in each class having average marks>60%.
3) Count the total number of records in this table.
4) Display name of the student who scores highest marks.
5) Add a new field phone_no.
6) Find the class with the most students.
7) Give all students of 'BCA' class 10% increment in marks.
Q3. Consider the following database:-

Emp (empno , ename, job, salary, hiredate, deptno)


Dept (deptno, dname, location)
1) Add 5 records in Emp table
2) Add 5 records in Dept table.
3) Display the name and salary for all employees whose salary is not in the range of 6700 and
7500.
4) Display the name and job title of all employees who don’t have a manager.
5) Display the names of all employees where the second letter of their name is ‘A’ or their name
contains ‘ES’.
6) Display the name of all employees who have two ‘A’ in their name and are in department 20.
7) Display the highest, lowest ,sum and average salary of all employees. Label the column
max_salary ,min_salary,sum_salary and average_salary respectively.

4. Create the following tables:-

Books (book_id, b_name, author, purchase_date, cost)


Members (m_id, m_name, address, phone, birth_date)
Book_issued (book_id, member_id, issue_date, return_date)

1) Add primary key constraint on book_id attribute of relation books and also on m_id attribute
of relation members.
2) Add foreign key constraint to relation book_issued where book_id references to book_id of
books and member_id references to m_id of members.
3) Write a query to modify the phone number whose member_id is 5510.
4) Write a query to add Not Null constraint on attribute b_name.
5) Modify the author field of relation books , change its data type to char(30).
6) Add a new attribute named ‘Publisher’ to relation books.
7) Delete field phone from relation member.

You might also like