Skip to content

This repository is a comprehensive collection of SQL commands, covering fundamental to advanced SQL syntax and examples.

Notifications You must be signed in to change notification settings

ankan24/SQL-A2Z

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SQL Commands A to Z

This repository is a comprehensive collection of SQL commands, covering fundamental to advanced SQL syntax and examples. Each command is illustrated with practical examples and explanations to build a solid understanding of SQL.

About the Repository

  • Purpose: To serve as a quick reference and learning resource for SQL commands.
  • Audience: Suitable for anyone learning SQL, from beginners to advanced users.
  • Content: Contains syntax, examples, and explanations for each SQL command category.

SQL Command Categories

  1. Data Retrieval (SELECT Statements)
  • SELECT: Retrieves data from one or more tables.
  • WHERE: Filters rows based on conditions.
  • ORDER BY: Sorts the result set.
  • LIMIT/OFFSET: Limits the number of rows returned.
  • DISTINCT: Eliminates duplicate rows.
  1. Aggregate Functions
  • COUNT(): Counts the number of rows.
  • SUM(): Calculates the sum of values.
  • AVG(): Calculates the average of values.
  • MIN() and MAX(): Returns the minimum and maximum values.
  • GROUP BY: Groups rows based on columns.
  • HAVING: Filters groups based on aggregate conditions.
  1. Table Joins
  • INNER JOIN: Selects records with matching values in both tables.
  • LEFT JOIN (LEFT OUTER JOIN): Selects all records from the left table and matched records from the right.
  • RIGHT JOIN (RIGHT OUTER JOIN): Selects all records from the right table and matched records from the left.
  • FULL JOIN (FULL OUTER JOIN): Selects all records when there is a match in either left or right table.
  • CROSS JOIN: Produces a Cartesian product of the two tables.
  • SELF JOIN: Joins a table with itself.
  1. Data Manipulation Language (DML)
  • INSERT INTO: Inserts new rows into a table.
  • UPDATE: Modifies existing rows in a table.
  • DELETE: Deletes rows from a table.
  • TRUNCATE: Removes all rows from a table without logging each row.
  1. Data Definition Language (DDL)
  • CREATE TABLE: Creates a new table.
  • ALTER TABLE: Modifies an existing table.
  • DROP TABLE: Deletes a table and its data.
  • RENAME TABLE: Changes the name of a table.
  • Constraints: PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK
  1. Data Control Language (DCL)
  • GRANT: Gives specific permissions to users.
  • REVOKE: Removes specific permissions from users.
  1. Transaction Control Language (TCL)
  • BEGIN/START TRANSACTION: Begins a transaction.
  • COMMIT: Saves the transaction changes.
  • ROLLBACK: Reverts changes since the last commit.
  • SAVEPOINT: Sets a savepoint within a transaction.

How to Use This Repository

  1. Clone the repository to your local machine:
  https://github.com/ankan24/SQL-A2Z.git
  1. Open any .sql file in your preferred SQL client or editor.

  2. Run and test each command example to gain hands-on experience with SQL.

About

This repository is a comprehensive collection of SQL commands, covering fundamental to advanced SQL syntax and examples.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages