Summ Revision XII IP
Summ Revision XII IP
JOIN UNION
1. Combining records from two tables 1. Combining records from two tables
having different structure. having similar structure
2. Order and number of columns can 2. Number of columns, column data
be different. types and order of columns must
match
2
3. SELECT * FROM A,B; 3. SELECT * FROM A UNION SELECT *
FROM B;
3
VARCHAR CHAR
1. Used for Variable length 1. Used for Fixed length string
string. 2. Size is not mandatory i.e default size
2. Size is mandatory. is 1.
3. Eg. Sname Varchar(10) will 3. Eg. Sname char(10) will occupy 10
occupy <=10 charcaters. always whether user enters less
characters.
LIKE OPERATOR is used to search a value similar to specific pattern in a column using
wildcard operator.
There are two wildcard operators – percentage sign (%) and underscore ( _ ).
The (%) percentage sign represents zero, one, or multiple characters, while the underscore
(_ ) represents any single character.
Display names, whose name's second letter is 'o'.
SELECT name FROM student WHERE name LIKE "_ o%";
IN: The IN operator is used to check a value in given set of options or list.
It allows us to specify multiple values in a WHERE clause
SELECT * FROM STUDENT WHERE SECTION IN(‘A’,’C’);
Not IN: The not IN operator is used to check a value not present in a given set of options
or list.
It allows us to specify multiple values in a WHERE clause
SELECT * FROM STUDENT WHERE SECTION IN(‘A’,’C’);
IS : IS operator its used to check presence null values in a column
Select * from emp where salary IS NULL;
IS not : IS not operator its used to check absence of null values or not null values in a
column
Select * from emp where salary IS not NULL;
BETWEEN: The BETWEEN operator is used to test a column value in a given range of
values. Both end values are inclusive.(like from 2500 to 3500)
SELECT * FROM student WHERE fees BETWEEN 2500 AND 3500;
Not BETWEEN: The not BETWEEN operator is used to test a column value not present in a
given range of values.
SELECT * FROM student WHERE fees NOT BETWEEN 2500 AND 3500;
DESC or DESCRIBE: to view structure(fields,constraints) of table
USE databasename: used to open or make a database active