SQL Assignment #1.
SQL Assignment #1.
After Logging In, click on “Start Coding Now” or Click on “SQL Worksheet” on top
left-side menu...you’ll see a screen similar to the one below:
HR.EMPLOYEES
For this assignment, write the SQL statement in Live SQL and then run/execute it. Once
you see the result copy your SQL statement and paste it into this Word document (be sure
to save this Word document). I don’t need to see your output.
NOTE: To learn SQL you need to actually run the SQL statements in Live SQL. Every
semester students copy other students’ statements or type SQL statements and don’t run
them (they will have errors keeping them from running). This behavior will undermine
you learning SQL and reduces what you are learning in this course. For your own
benefit, don’t do this.
Once you complete all the problems, submit this Word document as your SQL
Assignment #1.
1. Write (and run) the SQL statement that would display (output) all the records/rows
and columns/attributes within the database table HR.EMPLOYEES. What this SQL
statement is doing is displaying all the employees in the HR.EMPLOYEES table and
with this display, it shows you what data is in the HR.EMPLOYEES table for each of
these employees (e.g. their employee ID number, first name, last name, email, phone
number etc).
SELECT * FROM HR.EMPLOYEES; [This is an example of your answer for the first
question]
3. What would your SQL statement be if you want the same output/display from
question #2 but you want the column/attribute salary to be displayed first? Cut-and-paste
your SQL statement below: SELECT salary, last_name FROM HR.EMPLOYEES
4. Cut and paste the following SQL statement into LIVE SQL and then run it:
SELECT JOB_ID
FROM HR.EMPLOYEES;
Thoroughly explain to me what this SQL statement is accomplishing...(I don’t need to see
your output here...you just need to describe what this SQL statement is doing).
Now, run this same SQL statement but modify it so there won’t be any duplicate
JOB_IDs displayed in the output. Cut and paste your SQL statement below after you run
it and see the output in LIVE SQL. SELECT DISTINCT JOB_ID FROM
HR.EMPLOYEES;