0% found this document useful (0 votes)
20 views2 pages

SQL Quick Notes

Uploaded by

assistant0849
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

SQL Quick Notes

Uploaded by

assistant0849
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Quick Notes in 2 Pages

Join our Telegram channel for more Free Resources: http://telegram.me/sqlspecialist


Follow us on Linkedin: Data Analysts Linkedin Page

​ SQL Basics:

● SQL stands for Structured Query Language.

● It is a domain-specific language used for managing and manipulating relational

databases.

​ Database Components:

● Tables: Data is stored in tables with rows and columns.

● Columns: Define the type of data (e.g., text, numbers) stored in a table.

● Rows: Each row in a table represents a single record or data entry.

​ Common SQL Commands:

● SELECT: Retrieve data from a table.

● INSERT: Add new records to a table.

● UPDATE: Modify existing records in a table.

● DELETE: Remove records from a table.

​ SQL Clauses:

● WHERE: Used to filter records based on a specified condition.

● ORDER BY: Sort the result set in ascending or descending order.

● GROUP BY: Group rows based on a common value in a column.

● HAVING: Filter grouped rows based on a condition.

​ SQL Functions:

● COUNT(): Count the number of rows in a result set.

● SUM(): Calculate the sum of values in a column.

● AVG(): Calculate the average of values in a column.

● MAX(): Find the maximum value in a column.

● MIN(): Find the minimum value in a column.

​ SQL Joins:

● JOIN: Combines rows from two or more tables based on a related column.

● INNER JOIN: Returns only the matching rows from both tables.
● LEFT JOIN (or LEFT OUTER JOIN): Returns all rows from the left table and

matching rows from the right table.

● RIGHT JOIN (or RIGHT OUTER JOIN): Returns all rows from the right table and

matching rows from the left table.

● FULL JOIN (or FULL OUTER JOIN): Returns all rows when there is a match in

either table.

​ SQL Constraints:

● PRIMARY KEY: Ensures the uniqueness of values in a column, typically used to

identify records uniquely.

● FOREIGN KEY: Establishes a relationship between two tables based on a column

in one table referencing the primary key of another table.

● UNIQUE: Ensures that all values in a column are unique.

● NOT NULL: Ensures that a column cannot contain NULL values.

​ SQL DDL (Data Definition Language) Commands:

● CREATE TABLE: Create a new table.

● ALTER TABLE: Modify an existing table's structure.

● DROP TABLE: Delete a table and its data.

​ SQL DML (Data Manipulation Language) Commands:

● INSERT INTO: Add new records to a table.

● UPDATE: Modify existing records.

● DELETE FROM: Remove records from a table.

​ SQL Tips:

● Use comments (-- or /* */) to document your SQL queries.

● Practice and test your SQL statements on sample databases to improve your

skills.

● Be cautious when using DELETE and UPDATE statements, as they can have a

significant impact on your data.

Remember that SQL is a powerful tool for working with databases, and practice is key to

mastering it. Start with simple queries and gradually work your way up to more complex tasks.

Hope it helps :)

Join now for more free resources: http://telegram.me/sqlspecialist

You might also like