Skip to content

vallianand/SQL-coding-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 

Repository files navigation

SQL Practice – All-in-One File

This repository contains a single consolidated SQL file covering all major SQL concepts, assignments, and interview-style questions.
It includes queries, triggers, joins, views, procedures, and TCL operations, all written and executed in MySQL.


πŸ“˜ Contents Included in the SQL File

βœ… 1. Basic SQL Queries

  • SELECT, WHERE, DISTINCT
  • ORDER BY, LIMIT
  • IN, BETWEEN, NOT BETWEEN
  • IS NULL / IS NOT NULL

βœ… 2. String Functions

  • UPPER(), LOWER()
  • SUBSTRING()
  • CONCAT()

βœ… 3. Date Functions

  • NOW(), YEAR(), DATEDIFF()
  • Calculating employee tenure

βœ… 4. Constraints

  • PRIMARY KEY, FOREIGN KEY
  • UNIQUE constraints
  • ALTER TABLE operations

βœ… 5. Aggregate Functions

  • COUNT(), SUM(), AVG(), MAX(), MIN()

βœ… 6. Joins

  • INNER JOIN
  • LEFT JOIN
  • RIGHT JOIN
  • Multi-table joins

βœ… 7. Views

  • Simple view
  • Complex view joining Employees, Departments, Salaries

βœ… 8. Stored Procedures

  • Parameterized procedure to fetch employee details

βœ… 9. Triggers

  • AFTER DELETE trigger to log deleted Orders
  • Using OLD values

βœ… 10. Transactions (TCL Commands)

  • START TRANSACTION
  • SAVEPOINT
  • COMMIT
  • ROLLBACK
  • Bank transaction scenario

πŸ“‚ File Included in this Repository

file.

  1. Open the SQL file in MySQL Workbench or any SQL editor.

  2. Run each section to practice concepts or prepare for interviews.


🎯 Purpose of This Repository

This repository demonstrates practical understanding of SQL including:

  • Real-world scenarios
  • Database operations
  • Backend logic (procedures, triggers)
  • Data integrity (TCL, constraints)

Useful for:

  • Data Analyst roles
  • Software Developer roles
  • SQL interview preparation
  • Portfolio building
  • Recruiter evaluation

πŸ“¬ Contact

Feel free to connect with me on LinkedIn or GitHub for any collaboration.

About

Complete SQL practice questions and solutions in one file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published