Database Queries Examples

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

SELECT * FROM Customers WHERE City = 'Berlin';

All records where the city column has the value "Berlin"

SELECT*FROM Customers;

Get all the columns from the Customers table

SELECT * FROM Customers WHERE NOT City = 'Berlin';

Keyword to select all records where city is NOT "Berlin"

SELECT * FROM Customers ORDER BY City;

Select all records from the Customers table, sort the result alphabetically by the column City.

SELECT * FROM Customers Order BY COUNTRY, CITY;

Select all records from the Customers table, sort the result alphabetically, first by the column Country, then, by the column City.

SELECT * FROM Customers ORDER BY City DESC;

Select all records from the Customers table, sort the result reversed alphabetically by the column City.

SELECT *FROM Customers WHERE City = 'Berlin' AND PostalCode = 12209;

Select all records where the City column has the value 'Berlin' and the PostalCode column has the value 12209

SELECT * FROM Customers WHERE City= 'Berlin' OR City= 'London'

Select all records where the City column has the value 'Berlin', and also the records where the City column has the value 'London'.

SELECT *FROM Customers WHERE CustomerID = 32

Select all records where the CustomerID column has the value 32

SELECT DISTINCT Country FROM Customers;

Select all the different values from the Country column in the customer table

SELECT CITY FROM Customers;

Select the city column from the customers table


Kaugnay na mga set ng pag-aaral

Unit 3 - Part 2 Cellular Respiration - Glycolysis and Fermentation

View Set

International Marketing Chapter 1

View Set

Unit 2: Quiz 2 - Branches of Government

View Set

Module 6 Quiz: Security and Safety

View Set