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

Database Management System Practical SQL

This document discusses SQL (Structured Query Language) which was invented by IBM in 1970 to interact with relational database management systems. It divides SQL commands into three categories: DDL for data definition, DML for data manipulation, and DCL for data control. Examples are provided for creating tables, inserting data, describing table structure, and selecting data using conditions like BETWEEN, IN, LIKE, and IS NULL.

Uploaded by

nikjuj
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Database Management System Practical SQL

This document discusses SQL (Structured Query Language) which was invented by IBM in 1970 to interact with relational database management systems. It divides SQL commands into three categories: DDL for data definition, DML for data manipulation, and DCL for data control. Examples are provided for creating tables, inserting data, describing table structure, and selecting data using conditions like BETWEEN, IN, LIKE, and IS NULL.

Uploaded by

nikjuj
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 7

Database Management System

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:

DDL ( Data Definition language)-Create, Alter, Drop


DML ( Data Manipulation language)- Select, insert, update , delete DCL ( Data Control language)-grant, revoke

Create table employee( code number(5), Deptt char(10), name char(20), address varchar(30), DOB date);

Describe employee; ( Display table structure) Insert into employee values(101,abc,xyz,delhi,14-feb-2006);

insert into employee (code, deptt, name, address, dob) values(101,abc,xyz,delhi,14-feb-2006);

Insert into employee values (&code, '&deptt', '&name', &address', '&date');

Select Statement

Select code, name, salary from employee; select * from employee; select * from employee where salary >4000;

Select last_name, salary+300 from employee;


Select last_name, salary, 12*salary+100 from employee;

Select last_name, job_id from employee where last_name=abc;


Select last_name, salary from employee where salary between 2500 and 3500;

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

You might also like