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

Clauza SQL WHERE


<< Previous Page
sintaxa SQL
Next Page >>
sintaxa SQL

SQL Tutorial » Clauza SQL WHERE

Ce este clauza WHERE in SQL?

Clauza WHERE se foloseste pentru a filtra înregistr?rile introduse in baza de date.

Aceasta este folosit pentru a extrage doar anumite înregistr?ri care îndeplinesc o condi?ie specificat? in clauza.

Sintaxa SQL WHERE:

SELECT coloana1, coloana2, coloana3, ...
FROM nume_tabel
WHERE conditie;
Nota: Clauza WHERE este folosit? in multe alte instructioni precum SELECT, UPDATE, DELETE etc.!

 

In exemplul de mai jos avem un tabel „Clien?i” dintr-o baza de date precum "Test_clienti":

ID Prenume Nume Tara Oras Produs ID Cantitatea
1 Clark Kent USA Miami 24 11
2 Pire Joveau France Paris 56 32
3 Cristian Andone Romania Brasov 67 9
4 Pepe Martínez Spain Madrid 112 26
5 Peter Parker SUA Los Angeles 19 41

 

Clauza WHERE Exemple

In urm?toarea instruc?iune SQL folosim clauza WHERE unde cu ajutorul acesteia selectam to?i clien?ii din ?ara „SUA”, din tabelul „Clien?i”:

SELECT * FROM Clien?i
WHERE Tara='USA';

Rezultatul: Num?r de înregistr?ri: 2

ID Prenume Nume Tara Oras Produs ID Cantitatea
1 Clark Kent SUA Miami 24 11
5 Peter Parker SUA Los Angeles 19 41

 

Related subjects:
Sintaxa SQL Instructiunea Select Insert data into SQL Display data from SQL

 

Tags: sql where în tabel, WHERE select distinct, WHERE select ultimul rând, primul, valori, baz? de date, distinct, top
Ce este clauza WHERE * în SQL?

 

Câmpuri numerice WHERE Exemple

In jurul valorilor text SQL necesit? ghilimele simple (majoritatea sistemelor de baze de date vor permite ?i ghilimele duble), iar cu toate acestea, câmpurile numerice nu trebuie incluse între ghilimele

SELECT * FROM Clienti WHERE ID=4;

Rezultatul: Num?r de înregistr?ri: 1

ID Prenume Nume Tara Oras Produs ID Cantitatea
4 Pepe Martínez Spain Madrid 112 26

 

Urmatorul exemplu listeaz? "ai mare decat " din tabelul „Clien?i”:

SELECT * FROM Clienti
WHERE ProdusID > 60;

Rezultatul: Num?r de înregistr?ri: 2

ID Prenume Nume Tara Oras Produs ID Cantitatea
3 Cristian Andone Romania Brasov 67 9
4 Pepe Martínez Spain Madrid 112 26

 

SQL WHERE - mai mare sau agal

Urmatorul exemplu listeaz? WHERE "Mai mare sau egal " din tabelul „Clien?i”:

SELECT * FROM Clienti
WHERE ProdusID >=56;

Rezultatul: Num?r de înregistr?ri: 3

ID Prenume Nume Tara Oras Produs ID Cantitatea
2 Pire Joveau France Paris 56 32
3 Cristian Andone Romania Brasov 67 9
4 Pepe Martínez Spain Madrid 112 26

 

Urmatorul exemplu listeaz? WHERE "Mai mica sau egal " din tabelul „Clien?i”:

SELECT * FROM Clienti
WHERE ProdusID <= 56;

 

Tags: sql where în tabel, WHERE select distinct, WHERE select ultimul rând, primul, valori, baz? de date, distinct, top Ce este clauza WHERE * în SQL?

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