0% found this document useful (0 votes)
118 views1 page

Below Is An Example of A Table Called "Persons":: P - Id Lastname Firstname Address City

The document describes examples of SQL SELECT queries on a sample Persons table with columns for ID, last name, first name, address, and city. It shows how to select all columns, specific columns, unique city values, and rows matching certain criteria using WHERE clauses with AND and OR operators. The results of each example query are displayed.

Uploaded by

Bipin Prajapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views1 page

Below Is An Example of A Table Called "Persons":: P - Id Lastname Firstname Address City

The document describes examples of SQL SELECT queries on a sample Persons table with columns for ID, last name, first name, address, and city. It shows how to select all columns, specific columns, unique city values, and rows matching certain criteria using WHERE clauses with AND and OR operators. The results of each example query are displayed.

Uploaded by

Bipin Prajapati
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Below is an example of a table called "Persons":

P_Id LastName FirstName Address 1 Hansen Ola Timoteivn 10 2 Svendson Tove Borgvn 23 3 Pettersen Kari Storgt 20
1) SELECT * FROM Persons; 2) SELECT LastName,FirstName FROM Persons; 3) SQL SELECT DISTINCT Syntax SELECT DISTINCT column_name(s) FROM table_name; 4) SELECT DISTINCT City FROM Persons;

City Sandnes Sandnes Stavanger

The result-set will look like this: City Sandnes Stavanger


5) SELECT * FROM Persons WHERE FirstName='Tove' AND LastName='Svendson'; The result-set will look like this:

P_Id LastName FirstName Address City 2 Svendson Tove Borgvn 23 Sandnes


6) SELECT * FROM Persons WHERE FirstName='Tove' OR FirstName='Ola';

The result-set will look like this: P_Id LastName FirstName Address City 1 Hansen Ola Timoteivn 10 Sandnes 2 Svendson Tove Borgvn 23 Sandnes

You might also like