SQL commands (P2) Flashcards

1
Q

SQL query for selecting ProductName, SupplierID from a table called Products where Price = 21 and Stock < 30

A

SELECT ProductName, SupplierID FROM Products WHERE Price == 21 AND Stock < 30

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Select all the records in a table called Products where “Sauce” appears in ProductName

A

SELECT * FROM Products WHERE ProductName LIKE “Sauce”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

You have 2 tables, one table called ACCOUNTS with fields:

Acc_No, Customer_ID, Balance, Acc_Type

and another called CUSTOMERS:

Customer_ID, Family_Name, Zip_Code, Phone

Create an SQL query to select the names of customers and balance whose account balance is greater than $300,000

A

SELECT CUSTOMERS.Family_Name, ACCOUNTS.Balance FROM CUSTOMERS INNER JOIN ACCOUNTS ON ACCOUNTS.CustomerID = CUSTOMERS.CustomerID WHERE ACCOUTNS.Balance > 300000

How well did you know this?
1
Not at all
2
3
4
5
Perfectly