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

DBMS Lab Assignment-1

The document provides details about two relational database schemas - one for an examination office application and one for an order processing application. It includes the tables, attributes, and relationships for each schema. It also provides seven questions to write SQL queries and statements related to each schema.

Uploaded by

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

DBMS Lab Assignment-1

The document provides details about two relational database schemas - one for an examination office application and one for an order processing application. It includes the tables, attributes, and relationships for each schema. It also provides seven questions to write SQL queries and statements related to each schema.

Uploaded by

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

Database Management System (E1UA302B)

BCA 2022-23 II Sem III


Lab Assignemnt-1

Q1: Consider the following relational schema for the Office of the Controller of Examinations Application.
Student (Rollno, Name, Dob, Gender, Doa, Bcode);
Implement a check constraint for
• Gender
• Date of Admission
Branch (Bcode, Bname, Dno);
Department (Dno, Dname);
Course (Ccode, Cname, Credits, Dno);
Branch_Course (Bcode, Ccode, Semester);
Enrolls (Rollno, Ccode, Sess, Grade);

For Example:
SESS can take values ‘APRIL 2013’, ‘NOV 2013’
Implement a check constraint for grade Value Set (‘S’, ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘U’ );
Students are admitted to Branches and they are offered by Departments. A branch is offered by only one
department.
Each branch has a set of Courses (Subjects). Each student must enroll during a semester. Courses are offered by
Departments. A course is offered only by one department. If a student is unsuccessful in a course he/she must
enroll for the course during next session. A student has successfully completed a course if the grade obtained by
is from the list (A, B, C, D, and E).
A student is unsuccessful if he/she have grade ‘U’ in a course.
Primary Keys are underlined.

Questions
1. Develop a SQL query to list details of Departments that offer more than 3 branches.
2. Develop a SQL query to list the details of Departments that offer more than 6 courses.
3. Develop a SQL query to list the details of courses that are common for more than 3 branches.
4. Develop a SQL query to list students who got ‘S’ in more than 2 courses during single enrolment.
5. Create a view that will keep track of the roll number, name and number of courses, a student has
completed successfully.

Q2: Consider the following relations for an Order Processing Database application in a Company.
Customer (Customerno varchar2 (5), Cname varchar2 (50));
Implement check constraints to check Customerno starts with ‘C’
Cust_Order (Orderno varchar2(5), Odate Date, Customerno references Customer, Ord_amt
number(8));
Implement check constraints to check Orderno starts with ‘O’.
Ord_amt is derived attribute (default value is 0);
Item (Itemno varchar2 (5), Item_name varchar2 (30), unit_price number (5));
Implement check constraint to check Itemno starts with ‘I’.
Order_item (Orderno references Cust_order, Itemno references item, qty number (3));
Primary Key is underlined.
Questions
1. Develop DDL to implement above schema enforcing primary key, check constraints and foreign key
constraints.
2. Develop SQL query to list the details of customers who have placed more than 3 orders.
3. Develop a SQL query to list details of items whose price is less than the average price of all items in
each order.
4. Develop a SQL query to list the orderno and number of items in each order.
5. Develop a SQL query to list the details of items that are present in 25% of the orders.
6. Develop an update statement to update the value of Ord_amt.
7. Create a view that keeps track of detail of each customer and number of Order placed.

You might also like