IMP - Unit - 2
IMP - Unit - 2
IMP - Unit - 2
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’.
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.
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.
Define
i)Primary Key
ii)Candidate Key