SQL Flashcards
How to select salary and add 300?
select salary, firstname, salary+300 from employees;
Use aliases for select firstname and say name
select first_name as FirstName from Employees;
Use aliases for select firstname and say name
select first_name as FirstName from Employees;
Concatenate firstname and lastname and alias as full name
select firstname||lastname as fullname from employees;
Get this output for me: "Nilima is a programmer" and nilima = firstname job = programmer with alias
select firstname ||’is a ‘|| job as employee_details from employees;
Use q operator and write down “yea”
select firstname|| q’{yea] || managers as “Managers” from employees;
Display all rows from employees
select department_id * from employees;
Display unique elements
select DISTINT department_id from employees;
What does Describe do?
Displays the structure of a table
Select from employees where last_name is nilima.
and avoid that common mistake
select last_name
from employees
where
last_name=”nilima”;
Select from employees where salary is less than 300, more than 300, between 200-800
select salary from employees
where salary BETWEEN 200 AND 800;
select salary from employees where salary <=300;
Select names that begin with like “anychari”
select firstname from employees where firstname like ‘_i%’;
How to find null manager id from employees?
select manager_id from employees where manager_id IS NULL;
select from employees where salary is greater than 1000 and job_id is has the word “man” so IT_MAN
select manager_id from employees where
salary>=1000
AND
job_id LIKE ‘%MAN%’;
select from employees where salary is greater than 1000 or job_id is has the word “man” so IT_MAN
select manager_id from employees where
salary>=1000
or
job_id LIKE ‘%MAN%’;