The Table name is Albums and the column name is Title. Write a query that shows the names of all albums.
SELECT Title
FROM Albums;
The Table name is Albums and the column name is Title. Write a query that shows the names of all Albums in Ascending Alphabetical Order.
SELECT Title
FROM Albums
ORDER BY Title ASC;
Write a query that shows all Albums by the artist with ArtistId = 58, assuming you have an Albums table that contains the columns Title
SELECT Title
FROM Albums
WHERE ArtistId = 58;
Write a query that shows all Customers who live in Canada from the Country column in the Customers table.
SELECT *
FROM Customers
WHERE Country = 'Canada';
Write a query that shows all Customers who live in Canada from the Country column in the Customers table. Order By LastName and Lascending Alphabetical Order
SELECT *
FROM Customers
WHERE Country = 'Canada'
ORDER BY LastName ASC;
Write a query that shows the FristName and LastName of all Customers who come from the Company "Microsoft Corporation", assuming the Customers table has the Column Company
SELECT FirstName, LastName
FROM Customers
WHERE Company = 'Microsoft Corporation';
Write a query that shows the FirstName and LastName of all Customers who do not have a Company (where the Company field is NULL)
SELECT FirstName, LastName
FROM Customers
WHERE Company IS NULL;
Write a query that shows the FirstName and LastName from the table Customers who live in either Sweden or Spain
SELECT FirstName, LastName
FROM Customers
WHERE Country IN ('Sweden', 'Spain');
Write a query that shows all the Customers from the USA that dont have Fax (where the Fax field is NULL)
SELECT *
FROM Customers
WHERE Country = 'USA' AND Fax IS NULL;
Write a query that shows all the Customers from the Country USA that have Fax (where the Fax field is not NULL)
SELECT *
FROM Customers
WHERE Country = 'USA' AND Fax IS NOT NULL;
Write a query that shows all the Customers from the Country USA in the City California that have Fax (where the Fax field is not NULL)
SELECT * FROM Customers
WHERE Country = 'USA' AND City = 'California' AND Fax IS NOT NULL;
Write a query that shows all the Email addresses from the Customers Table that end with "com"
SELECT Email
FROM Customers
WHERE Email LIKE '%.com';
Write a query that shows all the Email addresses from the Customers table that start with jack or stan
SELECT Email
FROM Customers
WHERE Email LIKE 'jack%' OR Email LIKE 'stan%';
Write a query that shows all the Email addresses from the Customers table that contain the word murray
SELECT Email
FROM Customers
WHERE Email LIKE '%murray%';
Write a query that shows the FirstName and LastName from the Customers table who have a PostalCode that starts with 6, 7, 8, or 9. Use LIKE
SELECT FirstName, LastName
FROM Customers
WHERE PostalCode LIKE '6%'
OR PostalCode LIKE '7%'
OR PostalCode LIKE '8%'
OR PostalCode LIKE '9%';
Write a query that shows the FirstName, LastName, City and PostalCode from the table Customers that live in Copenhagen
SELECT FirstName, LastName, City , PostalCode
FROM Customers
WHERE City = 'Copenhagen';
Write a query that shows the FirstName, LastName, City and PostalCode from the table Customers that live in Copenhagen and Paris
SELECT FirstName, LastName, City, PostalCode
FROM Customers
WHERE City = 'Copenhagen'
OR City = 'Paris';
The Table name is Tracks and the column name is Name. Write a query that shows all Tracks, Name that dose not have a UnitPrice of 0.99
SELECT Name
FROM Tracks
WHERE UnitPrice != 0.99;
The Table name is Tracks and the column name is Name. Write a query that shows all Tracks whose Name start with the word Go.
SELECT Name
FROM Tracks
WHERE Name LIKE 'Go%'