Employee names (chinook database)
Your goal is to complete challenges that test your SQL skills against real-world scenarios and data structures.
Database Schema
Here's a brief overview of the relevant tables in the Chinook database:
- "Employee": Contains details about employees.
- Columns: "EmployeeId", "LastName", "FirstName", and more...
Lab Instructions:
-
Environment Setup:
- The environment is pre-configured, so you don't need to worry about setting up any database connections or additional software. Simply focus on writing your SQL queries.
-
Writing Queries:
- Make sure to always use double quotes around table and column names for clarity. Example: SELECT "FirstName" FROM "Employee".
- Remember to utilize the
ORDER BY
clause when necessary to avoid output mismatches. - Be precise with column names. Any deviation from the original schema will lead to a mismatch in the expected solution, causing the lab test to fail.
-
Submission:
- Once you've written your SQL query for a challenge, you can run it to see if it matches the expected solution.
- Ensure you adhere to the exact table and column names as mentioned in the challenges to avoid discrepancies.
Best of luck with the challenges! Remember to pay close attention to detail and ensure your queries adhere to the provided specifications.
Challenge 1: Employee Name Retrieval
Objective: Your task is to retrieve the first and last names of all employees from the Chinook database. Ensure that you specify column names in your SELECT statement.
Specifications:
-
Table to Use:
Employee
-
Columns to Retrieve:
FirstName
LastName
-
Ordering Criteria: Retrieve results sorted by the
LastName
column.
Hint: Utilize the
ORDER BY
clause to sort results. Remember to always use double quotes around table and column names for clarity. For example:"TableName"
.