SQLite Queries

0.0(0)
studied byStudied by 6 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

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;

2
New cards

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;

3
New cards

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;

4
New cards

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';

5
New cards

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;

6
New cards

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';

7
New cards

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;

8
New cards

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');

9
New cards

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;

10
New cards

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;

11
New cards

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;

12
New cards

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';

13
New cards

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%';

14
New cards

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%';

15
New cards

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%';

16
New cards

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';

17
New cards

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';

18
New cards

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;

19
New cards

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%'