IMP - Unit - 2

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

Define the term:

i) Candidate key ii) Primary key

List four DDL commands with syntax.

Define normalization, list its types.

Explain set operators with example.

State and explain 1NF and 2NF with example.

Consider the following database Employee(emp_id, emp_name, emp_city, emp_addr,


emp_dept, join_date)
i) Display the emp_id, of employee who live in city ‘Pune’ or ‘Nagpur’.
ii) Change employee name, ‘Aayush’ to ‘Aayan’.
iii) Display the total number of employee whose dept is 50.

Mauli IT Solution D.R.Cholke (9404339085)


Define table and field.

Enlist DML commands.

Define primary key and foreign key.

Explain any four set operators in SQL with example.

State and explain 3NF with example.

Describe create & alter command with syntax & example

Write a command to create table student (rollno, Stud_name, branch, class,


DOB, City, Contact_no) and write down queries for following :
(i) Insert one row into the table
(ii) Save the data
(iii) Insert second row into the table
(iv) Undo the insertion of second row
(v) Create save point S 1 .
(vi) Insert one row into the table.

EMP (empno, deptno, ename, salary, designation, join_date, DOB,


dept_location). Write down SQL queries for following :
(i) Display employees name & number in decreasing order of salary.
(ii) Display employee name & employee number whose designation is Manager.
(iii) Display age of employees with ename.
(iv) Display total salary of all employees.
(v) Display employee names having deptno as 20 and dept_location is Mumbai.
(vi) Display name of employee who earned lowest salary.

Consider the structure for book table as Book-Master (bookid, bookname,


author, no_of copies, price)
Write down SQL queries for following
(i) Write a command to create Book_master table.
(ii) Get authorwise list of all books.
(iii) Display all books whose price is between ` 500 & ` 800.
(iv) Display all books with details whose name start with ‘D’.
(v) Display all books whose price is above ` 700.
(vi) Display all books whose number of copies are less than 10.
Mauli IT Solution D.R.Cholke (9404339085)
State any two E.F. Codd’s rule for RDBMS.

List DCL commands.

Define Normalization and list its types.

Explain difference between delete and truncate command with example.

State and explain 2NF with example.

List the SQL operations and explain range searching operation ‘between’ and
pattern matching operator ‘like’ with example.

Consider the table Student (name, marks, dept, age, place, phone, birthdate) Write SQL
query for following :
(i) To list students having place as ‘Pune’ or ‘Jalgaon’.
(ii) To list students having same department (dept) as that of ‘Rachana’.
(iii) To change marks of ‘Rahul’ from 81 to 96.
(iv) To list student name and marks from ‘Computer’ dept.
(v) To list student name who have marks less than 40.
(vi) To list students who are not from ‘Mumbai’.

Write a command to create table student (RNo., name, marks, dept.)


with proper datatype and RNo as primary key.

Mauli IT Solution D.R.Cholke (9404339085)


List any four data types in SQL

Define Normalization. Explain 2NF with example.

Explain any two DDL commands along with example.

Explain.
i) Candidate key
ii) Foreign key

i) Create table Student (S_id, S_name, S_addr, S_marks) with proper data type and size.
ii) Insert row (5, ‘ABC’, ‘RRRRR’, 79) into student table.
iii) Update marks of student 85 where S_id is 5.

Consider the following table employee (Emp_id, Emp_name, Emp_age)


i) Display details of employees whose age is less than 30.
ii) Display details of employees whose age is in between the range 30 to 60.
iii) Display total number of employee whose age is 60.
iv) Display names of employees whose name starts with 'S'.
v) Display details of employees whose name end with 'd'.
vi) Display details of employees whose age is greater than 50 and whose name contain
'e'.

Mauli IT Solution D.R.Cholke (9404339085)


Define Normalization. Enlist its types.

Write syntax for creating and Renaming a table.

Enlist arithmetic and logical SQL operators.

Write SQL queries for following:


i) Create table student with following attributes using suitable data types. Roll no., as
primary key, name, marks as not null and city.
ii) Add column Date of Birth in above student table.
iii) Increase the size of attribute name by 10 in above student table.
iv) Change name of Student table to stud.

Write down any four Dr. E.F Codd's rules.

Explain Primary and Unique key constraint with syntax.

Write the SQL queries for following EMP table. Emp (empno, deptno, ename, salary,
designation, city.)
i) Display average salary of all employees.
ii) Display names of employees who stay in Mumbai or Pune.
iii) Set the salary of employee 'Ramesh' to 50000.
iv)Display names of employees whose salaries are less than 50000.
v) Remove the Record of employees whose deptno is 10.
vi) Remove the column deptno from EMP table.

Write SQL queries for following. Consider table stud (roll no, name, subl, sub2, sub3)
i) Display names of student who got minimum mark in subl.
ii) Display names of students who got above 40 marks in sub2.
iii) Display count of Students failed in sub2.
iv) Display average marks of subl of all students.
v) Display names of students whose name start with 'A' by arranging them
in ascending order of subl marks.
vi) Display student name whose name ends with h' and subject 2 marks are between 60
to 75.

Mauli IT Solution D.R.Cholke (9404339085)


Write down any four Codd's rules.

Define
i)Primary Key
ii)Candidate Key

List any two DDL commands with syntax.

Explain not Null and Check constraint

Explain any four DML commands with syntax and example.

State and explain 1NF and 2NF with example

Mauli IT Solution D.R.Cholke (9404339085)

You might also like