Dbms External Que Paper

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

VISHNU INSTITUTE OF TECHNOLOGY (AUTONOMOUS)

VISHNUPUR: BHIMAVARAM
II B.TECH – I SEMESTER LAB EXTERNAL EXAMINATION

BRANCH: II-I (AI&DS-A & B) Date:


LAB: DBMS

Question # 1
1. Write Syntax of SQL Order By and Group By clauses
2. Write a procedure to print the multiplication table.
3. Create the following tables with the given information: SAILORS(sid, sname, age, rating)

BOATS(bid, bname, color)

RESERVES(sid, bid, day)

Use appropriate data types for the columns

4. Write SQL queries for the following:


a. Find the names of sailors who have reserved a red boat (using nested queries)
b. Find the names and ages of all the sailors
c. Find sids of sailors who have reserved both RED or GREEN
d. Write an ALTER TABLE command to add UNIQUE constraint on RATING
column in SAILORS table.
Question # 2
1. Explain different types of joins in SQL
2. Create STUDENT & BRANCH tables with the following schemas:
STUDENT (regdno, name, age, bname, perc)

BRANCH (bname, yoj, intake)

Use appropriate data types for the columns

3. Write a pl/sql block to check the number is even or odd, if even return true or else return
false.
4. Write SQL queries for the following
a. Write an SQL command to increase the NAME column size in STUDENT table
b. Display CSE & IT students’ details
c. Find the names of students studying in a branch “CSE” with more than 60
Percentage.
d. Find the name of the student who secured highest percentage.
Question # 3
1. Write a PL/SQL program to find the largest of 3 numbers.
2. Create the following tables with the given information: SAILORS(sid, sname, age, rating)

BOATS(bid, bname, color)

RESERVES(sid, bid, day) Use


appropriate data types for the columns
3. Explain about any 3 date functions.
4. Write SQL queries for the following:
a. Find the colors of boats reserved by sailor LUBBER.
b. Find the age of youngest sailor for each rating level
c. Find the ages of sailors whose name begins and ends with B and has at least 3
characters
d. Write an SQL command to delete sailors records with age more than 30 and rating
less than 10

Question # 4
1. Create PL/SQL procedure to find area and perimeter of the given circle.
2. Explain about different numeric functions.
3. Create STUDENT & BRANCH tables with the following schemas:
STUDENT (regdno, name, age, bname, perc)

BRANCH (bname, yoj, intake)

Use appropriate data types for the columns.

4. Write alter statements to add PRIMARY KEYs to the STUDENT and BRANCH tables.
Also write an alter statement to add FOREIGN KEY to the STUDENT table.
5. Write SQL queries for the following:
a. Display student’s details whose name starts with ‘a’.
b. Write a query to find the names of students studying in a branch started in the year
2008.
c. Display the student details by grouping them based on branch name.
Question # 5
1. Write a trigger that doesn’t allow insertion of data in the employee table.
2. Create EMP & DEPT tables with the following schemas:
EMP(EMPNO, ENAME, JOB, HIREDATE, SALARY,DEPTNO)
DEPT(DEPTNO, DNAME,

LOCATION) Use appropriate data types for


the columns. 3. Explain about DML commands?
4. Write alter statements to add a PRIMARY KEY to the EMP table and PRIMARY KEY to
the DEPT table. Also write an alter statement to add FOREIGN KEY to the EMP table.
5. Write SQL queries for the following:
a. Update the salary of the employee by incrementing 10% hike on the salary.
b. Write SQL queries to Display department wise highest salaries.
c. Drop the department table.

Question # 6
1. What is the difference between DELETE, TRUNCATE and DROP statements in
SQL
2. Create the following tables with the given information: SAILORS(sid, sname,
age, rating)

BOATS(bid, bname, color)

RESERVES(sid, bid, day)

Use appropriate data types for the columns

3. Write an ALTER TABLE command to add UNIQUE constraint on RATING column in


SAILORS table.
4. Create a trigger on the boats table that doesn’t allow the updation of boats data.
5. Write SQL queries for the following
a. Find sailors whose rating is better than every sailor called Horatio
b. Find the sailors with the highest rating
c. Find the names of the sailors who have reserved at least two boats

Question # 7
1. Create a function to reverse the given string
2. Create EMP & DEPT tables with the following schemas:
EMP(EMPNO, ENAME, JOB, HIREDATE, SALARY,DEPTNO)
DEPT(DEPTNO, DNAME, LOCATION)

Use appropriate data types for the columns.

3. Differentiate alter and update commands in detail 4. Write SQL queries for the following:
a. List employee details who are working in the Hyderabad location.
b. Group the employee based on the department and display the details.
c. Write a query to find the names of employee who started their career from the year
2008.
5. Write any 5 Numerical Functions for the above table.

Question # 8
1. Write a PL/SQL program to find the sum of digits in a given number
2. Write about DML commands in detail.
3. Create EMP & DEPT tables with the following schemas:
EMP(EMPNO, ENAME, JOB, HIREDATE, SALARY,DEPTNO)
DEPT(DEPTNO, DNAME,
LOCATION) Use appropriate data types for the
columns.
4. Write SQL queries for the following:
a. List employee details in departments 10 and 20.
b. List employee names and salary whose name contains 'A' as the third letter.
c. Display the department number and average salary, where the average salary is
greater than Rs. 2000.

Question # 9
1. Write and explain the structure of SQL SELECT statement with suitable
example
2. Create the following tables with the given information: SAILORS(sid, sname, age,
rating)

BOATS(bid, bname, color)

RESERVES(sid, bid, day)

Use appropriate data types for the columns

3. Write a pl/sql block to find whether the given number is Armstrong or not.
4. Write an ALTER TABLE command to add UNIQUE constraint on RATING column in
SAILORS table.
5. Write SQL queries for the following
a. Find the names of sailors who have not reserved boat number 103
b. Find the names of sailors who have reserved RED color boat.
c. Find the sailors whose rating is more than 7

Question #10
1. List and explain aggregate functions used in SQL with examples
2. Consider the following schema:
SAILORS(sid, sname, age, rating)

BOATS(bid, bname, color)

RESERVES(sid, bid, day)

Use appropriate data types for the columns

3. Write a pl/sql program to find the given number is a prime number or not.
4. Write the relational algebraic queries for the following:
a. Find the names of sailors who have reserved at least one boat
b. Find sids of sailors who have reserved both RED and GREEN boats (use set
operations)
c. Find the name of the oldest sailor.

INTERNAL EXAMINER EXTERNAL EXAMINER

You might also like