0% found this document useful (0 votes)
6 views1 page

SQL Rules Quick Guide

This quick guide outlines essential SQL rules, including the use of UPPERCASE for keywords, the necessity of semicolons at the end of statements, and proper syntax for filtering, sorting, and combining data. It emphasizes the importance of using WHERE clauses in UPDATE and DELETE operations, as well as the need for transactions and backups. Additionally, it advises against using SELECT * in production queries and highlights the use of aliases for improved readability.

Uploaded by

yassinbh1999
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)
6 views1 page

SQL Rules Quick Guide

This quick guide outlines essential SQL rules, including the use of UPPERCASE for keywords, the necessity of semicolons at the end of statements, and proper syntax for filtering, sorting, and combining data. It emphasizes the importance of using WHERE clauses in UPDATE and DELETE operations, as well as the need for transactions and backups. Additionally, it advises against using SELECT * in production queries and highlights the use of aliases for improved readability.

Uploaded by

yassinbh1999
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/ 1

SQL Rules - Quick Guide

- Use UPPERCASE for SQL keywords (e.g., SELECT, FROM, WHERE).

- Every SQL statement ends with a semicolon (;).

- Table names and column names must match the database structure.

- Single quotes are used for string values ('value').

- Use WHERE to filter data.

- Use AND/OR to combine conditions.

- Use ORDER BY to sort results.

- Use GROUP BY with aggregation functions.

- Use JOIN to combine tables.

- NULL means unknown or missing - use IS NULL to check it.

- Avoid SELECT * in production queries.

- Use aliases (AS) for readability.

- Use LIMIT or TOP to restrict rows.

- Subqueries go inside parentheses.

- Enclose column/table names with spaces or special characters in quotes or brackets ("name",

[name]).

- INSERT INTO needs matching columns and values.

- UPDATE must be used carefully - always with a WHERE clause.

- DELETE without WHERE deletes all rows.

- Use transactions for grouped operations (BEGIN, COMMIT, ROLLBACK).

- Always backup before major operations.

Page 1

You might also like