SELECT last_name, salary
FROM employees
WHERE salary < 2500;
FROM employees
WHERE salary < 2500;
SELECT last_name, salary
FROM employees
WHERE job_id = ‘SA_MAN’;
FROM employees
WHERE job_id = ‘SA_MAN’;
SELECT last_name, hire_date
FROM employees
WHERE hire_date < ’01-JAN-1990’;
FROM employees
WHERE hire_date < ’01-JAN-1990’;
SELECT last_name, salary
FROM employees
WHERE salary BETWEEN 3000 AND 3200;
SELECT employee_id, manager_id
FROM employees
WHERE manager_id IN (100, 120, 124);
SELECT last_name, job_id
FROM employees
WHERE UPPER(job_id) LIKE ‘AD%’;
FROM employees
WHERE UPPER(job_id) LIKE ‘AD%’;
SELECT last_name
FROM employees
WHERE last_name LIKE ‘_a%’;
SELECT last_name, manager_id
FROM employees
WHERE manager_id IS NULL;
Do NOT use “= NULL”.
Must use “IS NULL”.
SELECT last_name, job_id, salary
FROM employees
WHERE salary >= 4000
AND job_id
LIKE ‘%CLERK%’;
SELECT last_name, job_id, salary
FROM employees
WHERE salary >= 4000
OR job_id
LIKE ‘%CLERK%’;
SELECT last_name, job_id
FROM employees
WHERE job_id NOT
IN (‘SA_REP’,‘SA_MAN’);
SELECT last_name, job_id, salary
FROM employees
WHERE job_id LIKE ‘SALESMAN’
OR job_id LIKE ‘ANALYST’
AND salary > 1500;
FROM employees
WHERE job_id LIKE ‘SALESMAN’
OR job_id LIKE ‘ANALYST’
AND salary > 1500;
SELECT last_name, job_id, salary
FROM employees
WHERE (job_id LIKE ‘SALESMAN’
OR job_id LIKE ‘ANALYST’)
AND salary > 1500;
FROM employees
WHERE (job_id LIKE ‘SALESMAN’
OR job_id LIKE ‘ANALYST’)
AND salary > 1500;
SELECT last_name, job_id, hire_date
FROM employees
ORDER BY hire_date;
SELECT last_name, salary * 12 AS “annsal”
FROM employees
ORDER BY “annsal”;
SELECT employee_id, last_name
FROM employees
ORDER BY 1;
SELECT employee_id, department_id, salary
FROM employees
ORDER BY 2, salary DESC;
SELECT last_name, salary
FROM employees
ORDER by department_id;
SELECT * FROM dbproject.employee;
INSERT INTO EMPLOYEE (FirstName, LastName, Department, Phone, Email)
VALUES('Mary', 'Jacobs', 'Administration', '360-285-8110', 'Mary.Jacobs@WPC.com');
INSERT INTO Customers (CustomerName, City, Country)
VALUES ('Cardinal', 'Stavanger', 'Norway');
UPDATE Customers
SET ContactName='Alfred Schmidt', City='Hamburg';
SELECT * FROM dbproject.employee order by employeenumber asc;
SELECT * FROM dbproject.employee order by employeenumber desc;
SELECT * FROM dbproject.employee order by employeenumber;
SELECT * FROM dbproject.employee order by fristname = 'mary' or lastname = 'dell';
update dbproject.employee set firstname ='Amal' where employeenumber =1;
DELETE FROM dbproject.employee WHERE employeenumber =6;
DELETE dbproject.employee;
SELECT SUM(age) FROM dbproject.employee; // this will add all the numbers from this column's number
SELECT AVG(age) FROM dbproject.employee;
SELECT MAX(age) FROM dbproject.employee;
SELECT MIN(age) FROM dbproject.employee;
SELECT COUNT(age) FROM dbproject.employee;
SELECT * FROM Customers
WHERE Country='Germany'
AND (City='Berlin' OR City='München');
No comments:
Post a Comment