Database Management System Practical SQL
Database Management System Practical SQL
Database Management System Practical SQL
Practical SQL
SQL
SQL was invented by IBM in 1970 to get information into and out of relational database management system. SQL command divided into three categories:
Create table employee( code number(5), Deptt char(10), name char(20), address varchar(30), DOB date);
Select Statement
Select code, name, salary from employee; select * from employee; select * from employee where salary >4000;
IN condition
To test for values in a specified set of values. Select emp_id, last_name, manager_id from employee where manager_id in ( 100,101,201);
Select emp_id, last_name, manager_id from employee where last_name in (sharma, verma);
Like condition
It is used when you dont know the exact value to search . % denotes many character _ denotes any single character. Select first_name from employee where first_name like S%; Note: It will return all rows whose first name began with S. name began with s will not returned. Select first_name , join_date from employee where join_date like %95; Note: It will return all rows whose join date between Jan 1995 and Dec 1995.
Select last_name from employee where last_name like _o% ; Result: Kochhar Lorentz Mourgos Null Conditions : Test for Null using Is null operator.
Select last_name, manager_id from employee where manager_id is null. Last_name Kamal Manager_id