SQL commands (P2) Flashcards
SQL query for selecting ProductName, SupplierID from a table called Products where Price = 21 and Stock < 30
SELECT ProductName, SupplierID FROM Products WHERE Price == 21 AND Stock < 30
Select all the records in a table called Products where “Sauce” appears in ProductName
SELECT * FROM Products WHERE ProductName LIKE “Sauce”
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
SELECT CUSTOMERS.Family_Name, ACCOUNTS.Balance FROM CUSTOMERS INNER JOIN ACCOUNTS ON ACCOUNTS.CustomerID = CUSTOMERS.CustomerID WHERE ACCOUTNS.Balance > 300000