-- create CREATE TABLE EMPLOYEE ( empId int, name varchar(15), dept varchar(10) default 'janu', height int default '10', proff varchar(10), primary key(empId,name) ); INSERT INTO EMPLOYEE VALUES (1, 'Clark', 'Sales',20,'hi'); INSERT INTO EMPLOYEE VALUES (1, 'janu','lo%ki%',default,'huhu'); INSERT INTO EMPLOYEE (empId,name,dept,proff) VALUES (1, 'loki', default,'bye'); select * from EMPLOYEE; select * from EMPLOYEE where dept like 'lo%%'escape '%'; --select *, proff+' '+dept as hd from EMPLOYEE; /*select distinct * from EMPLOYEE;( we get all the records even after applying disticnt bz empid is primary key) select distinct name ,empId from employee; --distinct name and empid (combination of it unique) -- where - fillter -row by row --on one column --1 value - where condition --many value-can use in ,not in --same column in and or both are same --more or filters resultant rows will be higher --more and filters resultant rows will be lesser ---different columns will use and / or select * from EMPLOYEE where name='Janu'; or name !='loki' select * from EMPLOYEE where name not in ('janu')-- except janu all will show select * from EMPLOYEE where name in (); select * from EMPLOYEE where empId >1 and empId<15; select * from EMPLOYEE where empId between 1 and 5 (btw automactically selects both values) --if we want to add new column select * , profit/sales as ratio from EMPLOYEE --(profit ,sales cols in employee) - for exact match -and /or -- for pattern matching use like 'c%' *( starts with c ) %- 0 or more no of char _->only 1 char if we have '%'or / we need to escape then use escape '%' */