DEV Community

Cover image for Basic SQL commands cheat sheet📋
Mahmoud EL-kariouny
Mahmoud EL-kariouny

Posted on • Edited on

2

Basic SQL commands cheat sheet📋

1- SELECT

  • Select data from database.

2- FROM

  • Specify table we're puling from.

3- WHERE

  • Filter query to match a condition.

4- AS

  • Rename column or table with alias.

5- JOIN

  • Combine rows from 2 or more tables.

6- AND

  • Combine query conditions. All must be met.

7- OR

  • Combine query conditions. One must be met.

8- LIMIT

  • Limit rows returned. See also FETCH & TOP.

9- IN

  • Specify multiple values when using WHERE.

10- CASE

  • Return value on a specified condition.

11- IS NULL

  • Return only rows with a NULL In.

12- LIKE

  • Search for patterns in column.

13- COMMIT

  • Write transaction to database.

14- ROLLBACK

  • Undo a transaction block.

15- ALTER TABLE

  • Add/Remove columns from table.

16- UPDATE

  • Update table data.

17- CREATE

  • Create TABLE, DATABASE, INDEX or VIEW.

18- DELETE

  • Delete rows from table.

19- INSERT

  • Add single row to table.

20- DROP

  • Delete TABLE, DATABASE or INDEX.

21- GROUP BY

  • Group data into logical sets.

22- ORDER BY

  • Set order of result. Use DESC to reverse order.

23- HAVING

  • Same as WHERE but filters groups.

24- COUNT

  • Count number of rows.

25- SUM

  • Return sum of column.

26- AVG

  • Return average of column.

27- MIN

  • Return min value of column.

28- MAX

  • Return max value of column.

Connect with Me 😊

🔗 Links

linkedin

twitter

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (1)

Collapse
 
sharifu66 profile image
Sharifu Hamisi Masudi

Thanks very much