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

SQL Basics Tunisia

This document provides a summary of essential SQL commands including creating databases and tables, inserting, selecting, updating, and deleting records. It also covers additional commands such as ordering results, using distinct values, and filtering with conditions like BETWEEN, LIKE, and IN. Finally, it includes examples of grouping data and performing joins between tables.

Uploaded by

oussamaaloui96
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)
4 views2 pages

SQL Basics Tunisia

This document provides a summary of essential SQL commands including creating databases and tables, inserting, selecting, updating, and deleting records. It also covers additional commands such as ordering results, using distinct values, and filtering with conditions like BETWEEN, LIKE, and IN. Finally, it includes examples of grouping data and performing joins between tables.

Uploaded by

oussamaaloui96
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 Basic Commands Summary

Essential Commands:
CREATE DATABASE:

CREATE DATABASE nom_base;

CREATE TABLE:

CREATE TABLE nom_table (

id INT PRIMARY KEY,

nom VARCHAR(50),

age INT

);

INSERT:

INSERT INTO nom_table (id, nom, age)

VALUES (1, 'Ali', 20);

SELECT:

SELECT * FROM nom_table;

SELECT nom FROM nom_table;

SELECT * FROM nom_table WHERE age > 18;

UPDATE:

UPDATE nom_table

SET age = 21

WHERE id = 1;

DELETE:

DELETE FROM nom_table

WHERE id = 1;

Additional Commands:
ORDER BY:

SELECT * FROM nom_table

ORDER BY age ASC;


SELECT * FROM nom_table

ORDER BY age DESC;

DISTINCT:

SELECT DISTINCT age FROM nom_table;

BETWEEN, LIKE, IN:

SELECT * FROM nom_table WHERE age BETWEEN 18 AND 25;

SELECT * FROM nom_table WHERE nom LIKE 'A%';

SELECT * FROM nom_table WHERE age IN (18, 20, 22);

GROUP BY:

SELECT age, COUNT(*) FROM nom_table

GROUP BY age;

JOIN:

SELECT *

FROM table1

JOIN table2 ON table1.id = table2.id;

You might also like