DEV Community

Ramya .C
Ramya .C

Posted on

Day 23 of My Data Analytics Journey !

Today was a productive day in my Data Analytics learning! Here’s what I learned and practiced:


📚 Topics Learned

  • UNION vs UNION ALL

    • UNION → Combines results of two queries and removes duplicates.
    • UNION ALL → Combines results of two queries without removing duplicates.
  • Constraints in SQL

    • NOT NULL → Ensures a column cannot have NULL values.
    • DEFAULT → Provides a default value for a column if none is specified.
    • PRIMARY KEY → Unique identifier for each record (only one per table).
    • FOREIGN KEY → Maintains referential integrity between two tables.
    • UNIQUE → Ensures all values in a column are unique.
    • INDEX → Improves query performance on large datasets.
  • Timestamps

    • CURRENT_TIMESTAMP → Stores the current date & time.
    • DEFAULT CURRENT_TIMESTAMP → Auto-assigns the current timestamp when inserting data.

📝 Tasks Completed

  1. Extracted names from the movie table with two same letters in the same place.
  2. Found actors who acted in all movies.
  3. Company Database Queries:
  • ✅ Employee and their Manager (both in employee table).
  • ✅ Get project names of each employee (employee + employee_project + projects).
  • ✅ Department-wise employee count (departments + employee).
  • ✅ Show each project with its budget and total salaries of employees assigned (projects + employee_project + employees).
  • ✅ Find employees whose department is the same as their manager’s department.
  • ✅ List employees who are not working on any project (employee_project + employee).
  • ✅ Find the manager with the most employees reporting to them.

💡 Key Takeaway

Learning UNION, constraints, and advanced SQL joins helped me understand how to manage relational databases better. Today’s hands-on tasks gave me confidence in writing queries for *real-world business use *

Top comments (0)