Sunday, November 29, 2015

Basic SQL Database Query Command

Retrieve all data from a table in the database

Select * From Customers;



Retrieve specific column data from a table in the database

Select customers.customername, customers.contactname
From customers

Simplified command

Select customername, contactname
From customers



Retrieve data and group the common data as 1 distinct group

Select Distinct Country
From customers;



Retrieve Specific (unique) data from a table

Select * From customers
Where country ='Mexico';



Retrieve Specific Column Specific data from a table

Select country, customername
from customers
Where country='Germany';



Operator parameters



Retrieve data from a table for a specific unique data

SELECT * FROM Customers
WHERE Country='Germany'
AND City='Münster'



Retrieve multiple specific data from a tabel

SELECT * FROM Customers
WHERE Country='Germany'
AND (City='Berlin' OR City='München');

No comments:

Post a Comment