Kyurious Minds Computer Academy SQL SQL – Practice Activity

SQL – Practice Activity

Part 1: Setting Up the Database

  1. Create the following tables in PostgreSQL:
    • Students
    • Courses
    • Enrollments
  2. Insert initial data into the Students and Courses tables.
  3. Connect PostgreSQL to Excel using the ODBC driver.
    • Retrieve and display Students and Courses data in Excel.

Part 2: SQL Queries and Data Manipulation

  1. Select Data from Tables:
    • Write a SELECT query to display all students.
    • Write a SELECT query to display all courses with more than 3 credits.
    • Write a nested SELECT query to find all students enrolled in the ‘Mathematics’ course.
  2. Insert Data Using Nested SELECT:
    • Write a query to insert enrollment records for students into the ‘Physics’ course.
    • Use a nested SELECT query to insert records for students in the ‘Biology’ course if they have an ‘A’ grade in ‘Physics’.
  3. Update Data:
    • Write a query to update the age of a specific student.
    • Write an UPDATE query with a nested SELECT to change grades for students in the ‘Mathematics’ course.
  4. Use of JOINs:
    • Write an INNER JOIN query to list all students with their enrolled courses.
    • Write a LEFT JOIN query to find students not enrolled in any course.
    • Write a RIGHT JOIN query to list all courses, including those without any students enrolled.

Part 3: Export Data to Excel and Analyze

  1. Retrieve Data in Excel:
    • Import the result sets of the above queries into Excel.
  2. Visual Analysis:
    • Create a dashboard in Excel showing:
      • Total number of students.
      • Number of courses and total enrollments.
      • A bar chart of students in each course.