Login using Social Account
     Continue with GoogleLogin using your credentials
To select the rows meeting only certain criteria, use WHERE clause.
Syntax:
SELECT col1,col2 FROM table1 WHERE conditon1 AND/OR condition2 .....
SELECT col1,col2 FROM table1 WHERE (col1='123' and col2='456') OR col3='4';
Operators:
Insert some sample data:
%%sql
insert into emp_<<your lab username>> (empfname, emplname, depid, doj, empsal,mgrempid)
values('Beck','Dot',2,'2014-09-10',2500,1);
insert into emp_<<your lab username>> (empfname, emplname, depid, doj, empsal,mgrempid)
values('Jack','Den',2,'2017-10-28',2400,3);
insert into emp_<<your lab username>> (empfname, emplname, depid, doj, empsal,mgrempid)
values('Emil','Bon',3,'2018-01-20',2100,1);
insert into emp_<<your lab username>> (empfname, emplname, depid, doj, empsal,mgrempid)
values('Siera','Leck',3,'2014-02-17',2000,4);
insert into emp_<<your lab username>> (empfname, emplname, depid, doj, empsal,mgrempid)
values('Koe','Hoker',3,'2016-03-16',2900,4);
insert into emp_<<your lab username>> (empfname, emplname, depid, doj, empsal,mgrempid)
values('Kate','Huds',4,'2017-11-22',2500,3);
insert into emp_<<your lab username>> (empfname, emplname, depid, doj, empsal,mgrempid)
values('Rene','Swaz',4,'2017-09-19',2450,3);
Filter the data based on some conditions as shown below:
%%sql
select * from emp_<<your lab username>> where empfname = "Beck";
select * from emp_<<your lab username>> where empsal > 2300;
select * from emp_<<your lab username>> where empsal between 2400 and 2600;
All these operators can be used on the number as well as strings. When needed, numbers are implicitly converted into strings before comparison.
%%sql
select * from emp_<<your lab username>> where depid=4;
The below gives all the records whose empfname values have ck:
%%sql
select * from emp_<<your lab username>> where empfname like '%ck%';
This 'where' clause can be used in insert/update/delete statements too.
Taking you to the next exercise in seconds...
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...