• Home
  • Azure
  • OpenShift
  • Kubernetes
  • Docker
  • Security
  • Database
  • Programming
  • Linux
  • Artificial Intelligence
  • Contact
  • More
    • Home
    • Azure
    • OpenShift
    • Kubernetes
    • Docker
    • Security
    • Database
    • Programming
    • Linux
    • Artificial Intelligence
    • Contact
  • Home
  • Azure
  • OpenShift
  • Kubernetes
  • Docker
  • Security
  • Database
  • Programming
  • Linux
  • Artificial Intelligence
  • Contact

Disclaimer

The links provided on this website are for informational purposes only. I do not necessarily agree with, endorse, or take responsibility for the content, views, or accuracy of any external websites linked here. Use them at your own discretion.

Database Management

  •  Show databases SHOW DATABASES; 
  • Create a database CREATE DATABASE database_name; 
  • Use a database USE database_name; 
  • Drop a database DROP DATABASE database_name; 

Table Management

  • Show tables SHOW TABLES; 
  • Create a table CREATE TABLE table_name (column1 datatype PRIMARY KEY,  column2 datatype, column3 datatype ); 
  • Describe table structure DESCRIBE table_name;
  • Drop a table DROP TABLE table_name; 
  • Alter a table (add column) ALTER TABLE table_name ADD column_name datatype; 
  • Alter a table (drop column) ALTER TABLE table_name DROP COLUMN column_name; 

Data Manipulation (CRUD Operations)

Insert Data

  • Insert into table INSERT INTO table_name (column1, column2) VALUES ('value1', 'value2'); 

Read Data

  • Select all records SELECT * FROM table_name; 
  • Select specific columns SELECT column1, column2 FROM table_name;
  • Filter data (WHERE clause) SELECT * FROM table_name WHERE column1 = 'value'; 

Update Data

  • Update records UPDATE table_name SET column1 = 'new_value' WHERE column2 = 'condition'; 

Delete Data

  • Delete specific records DELETE FROM table_name WHERE column1 = 'value'; 
  • Delete all records DELETE FROM table_name; 

Query Modifiers

  •  Sorting (ORDER BY) SELECT * FROM table_name ORDER BY column_name ASC; -- ASC (Ascending) | DESC (Descending) 
  • Limit results SELECT * FROM table_name LIMIT 10; 
  • Count rows SELECT COUNT(*) FROM table_name; 

Joins

  •  Inner Join SELECT a.column, b.column FROM tableA a INNER JOIN tableB b ON a.common_column = b.common_column; 
  • Left Join SELECT a.column, b.column FROM tableA a LEFT JOIN tableB b ON a.common_column = b.common_column; 
  • Right Join SELECT a.column, b.column FROM tableA a RIGHT JOIN tableB b ON a.common_column = b.common_column; 
  • Use the link below to learn more about joins

                   https://www.atlassian.com/data/sql/sql-join-types-explained-visually    

Aggregation Functions

  • Sum SELECT SUM(column_name) FROM table_name; 
  • Average SELECT AVG(column_name) FROM table_name; 
  • Maximum / Minimum SELECT MAX(column_name) FROM table_name; SELECT MIN(column_name) FROM table_name; 
  • Group By SELECT column_name, COUNT(*) FROM table_name GROUP BY column_name; 

Free learning resources

    https://www.w3schools.com/sql/

Copyright © 2025 zuliangwu.com - All Rights Reserved.

Powered by

This website uses cookies.

We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.

Accept