0% found this document useful (0 votes)
34 views1 page

SQL Notes Extra Class

This document provides SQL commands for creating tables, selecting data from tables, and using WHERE clauses with conditions like equal to, not equal to, greater than, less than, AND, OR and IN to filter data. It also shows using LIKE to search for patterns in data.

Uploaded by

NIMRIT KAUR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

SQL Notes Extra Class

This document provides SQL commands for creating tables, selecting data from tables, and using WHERE clauses with conditions like equal to, not equal to, greater than, less than, AND, OR and IN to filter data. It also shows using LIKE to search for patterns in data.

Uploaded by

NIMRIT KAUR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL NOTES

FOR CREATING TABLE: CREATE TABLE employee(empcode VARCHAR(4),empname VARCHAR(20),salary


NUMERIC,city VARCHAR(10))

SELECT(COLUMN name)

FROM (TABLE name)

WHERE (conndition)

SELECT * FROM employee

SELECT empname,salary FROM employee WHERE salary<6000000000 --------- data extraction

SELECT empname,salary FROM employee WHERE salary>=500000000000

SELECT empname,salary FROM employee WHERE salary!=500000000000--- not equal to

SELECT empname,salary,city FROM employee WHERE salary>=500000000 AND city='Ludhiana'

SELECT empname,salary,city FROM employee WHERE salary>=500000000 AND city='Ludhiana' AND


empname='Amar'

SELECT empname,salary,city FROM employee WHERE salary>=5000000 OR city='Ludhiana'

SELECT empname,salary,city FROM employee WHERE City='Rajasthan' OR city='Ludhiana'

SELECT empname,salary,city FROM employee WHERE City IN ('Ludhiana','Rajasthan','Goa')

SELECT empname,salary,city FROM employee WHERE City NOT IN ('Ludhiana','Rajasthan','Goa')

SELECT empname,salary,city FROM employee WHERE City NOT IN ('Ludhiana','Rajasthan','Goa') AND


salary>500000

SELECT empname,salary,city FROM employee WHERE empname LIKE 'S%'

SELECT empname,salary,city FROM employee WHERE empname LIKE 'S%'AND city LIKE 'R%'

SELECT empname,salary,city FROM employee WHERE empname LIKE '_a%'

SELECT empname,salary,city FROM employee WHERE empname LIKE '_h_s%'

You might also like