AgerNic.com/ro
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL
Tutorial

Sintaxa SQL


<< Previous Page
PHP Syntax
Next Page >>
PHP echo - print

SQL Tutorial » Sintaxa SQL

Care este sintaxa SQL?

O bază de date conține de cele mai multe ori unul sau mai multe tabele. Fiecare tabel este identificat printr-un nume (de exemplu, „Clienți” sau „Comenzi”). Tabelele conțin înregistrări (rânduri) cu date.

Toate instrucțiunile SQL încep cu oricare dintre cuvintele cheie precum SELECT, INSERT, UPDATE, DELETE, ALTER, DROP, CREATE, USE, SHOW și toate instrucțiunile se termină cu punct și virgulă (;).

De tinut minte este faptul ca SQL este case insensitive, adica "SELECT" inseamna acelasi lucru cu "select", dar numele tabelelor sunt case sensitive.

Sintaxa SQL SELECT Statement:

SELECT coloana_1, coloana_2 .... coloana_n FROM nume_tabel;

 

Sintaxa SQL DISTINCT

SELECT DISTINCT coloana_1, coloana_2 .... coloana_N FROM nume_tabel;

SQL WHERE Clause

SELECT DISTINCT coloana_1, coloana_2 .... coloana_N FROM nume_tabel
WHERE CONDITION;

 

SQL AND/OR Clause

SELECT DISTINCT coloana_1, coloana_2 .... coloana_N FROM nume_tabel;
WHERE CONDITION-1 {AND|OR} CONDITION-2;

SQL IN Clause

SELECT DISTINCT coloana_1, coloana_2 .... coloana_N
FROM nume_tabel
WHERE coloana_nume IN (val-1, val-2,...val-N);

 

SQL BETWEEN Clause

SELECT DISTINCT coloana_1, coloana_2 .... coloana_N
FROM nume_tabel
WHERE column_name BETWEEN val-1 AND val-2;

 

SQL LIKE Clause

SELECT DISTINCT coloana_1, coloana_2 .... coloana_N
FROM nume_tabel
WHERE column_name LIKE { PATTERN };

 

SQL ORDER BY Clause

SELECT DISTINCT coloana_1, coloana_2 .... coloana_N
FROM nume_tabel
WHERE WHERE CONDITION ORDER BY column_name {ASC|DESC};

 

Se va folosi punct și virgulă la sfârșitul fiecărei instrucțiuni SQL.

Tags: Baze de date sql exemple, Exercitii rezolvate, Interogari sql exemple, Comenzi, Exercitii sql online, Interogari rezolvate, Conditii

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


analytics piwika