SQL Statements

Select Data

SELECT LastName (Column) FROM EMPLOYEE (Table)

Note: * = All Data

Join Data

INNER JOIN Job_Title (Table) ON EMPLOYEE (Table to join the data).JobID (The column to Select)=Job_Title.JobID

Update Data

UPDATE EMPLOYEE

SET Column Name = ‘Value’

Insert Data

INSERT INTO EMPLOYEE

(Column Name, Column Name)

VALUES (‘Value’, ‘Value’)

Between Data

WHERE Column BETWEEN Value AND Value

UNION

SELECT Column, Column FROM Table

INNER JOIN Table ON Table.Column = Table.Column

WHERE Column BETWEEN Value AND Value

Like Data

WHERE Column LIKE ‘Value%’

Note: Percent sign acts like a wildcard for data that starts with the Value.

 

 

 

 

Increase all employees’ salaries with the selected EEO-1 classification by 10 percent.

UPDATE EMPLOYEE

Set Salary = Salary * 1.10

FROM EMPLOYEE

INNER JOIN JOB_TITLE

ON EMPLOYEE.JobID = JOB_TITLE.JobID

WHERE EEO1Classification = ‘Sales Worker’

Increase all employees’ salaries by 5 percent.

UPDATE EMPLOYEE

Set Salary = Salary * 1.05

Choose an employee from the Employee table and delete that employee.

DELETE FROM EMPLOYEE

WHERE LastName=’McMullen’ AND FirstName=’Eric’

Calculate the average salary for all employees.

SELECT AVG(Salary)

FROM EMPLOYEE

Calculate the maximum salaries for exempt and non-exempt employees.

SELECT ExemptStatus, MAX(Salary)

FROM EMPLOYEE

INNER JOIN JOB_TITLE

ON EMPLOYEE.JobID = JOB_TITLE.JobID

GROUP BY ExemptStatus

Calculate the maximum salary for all employees.

SELECT MAX(Salary)

FROM EMPLOYEE

Calculate the minimum salaries for exempt and non-exempt employees.

SELECT ExemptStatus, MIN(Salary)

FROM EMPLOYEE

INNER JOIN JOB_TITLE

ON EMPLOYEE.JobID = JOB_TITLE.JobID

GROUP BY ExemptStatus

Calculate the minimum salary for all employees.

SELECT MIN(Salary)

FROM EMPLOYEE

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>