sql

Ace your homework & exams now with Quizwiz!

how can you insert "Olsen" as the "LastName" in the "Persons" table?

INSERT INTO Persons (LastName) VALUES ('Olsen')

how can you insert a new record into the "Persons" table?

INSERT INTO Persons VALUES ('Jimmy', 'Jackson')

Use the MIN function to select the record with the smallest value of the Price column. (table named products)

SELECT MIN(Price) FROM Products;

how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

SELECT * FROM Persons ORDER BY FirstName DESC

how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

SELECT * FROM Persons WHERE FirstName LIKE 'a%'

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

SELECT * FROM Persons WHERE FirstName='Peter'

How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?

UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'

how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

Use an SQL function to calculate the average price of all products (table named products)

SELECT AVG(Price) FROM Products;

Use the correct function to return the numbers of records that have the Price value set to 18 (table named products)

SELECT COUNT (*) FROM Product WHERE Price =18;

, how can you return the number of records in the "Persons" table?

SELECT COUNT(*) FROM Persons

Use an SQL function to select the record with the highest value of the Price column. (table named products)

SELECT MAX(Price) FROM product

Use an SQL function to calculate the sum of all the Price column values in the Products table (table named products)

SELECT SUM(Price) FROM Products;

Use the correct function to return the numbers of records that have the Price value set to 18 (table names products)

SELECT count (*) FROM Products where Price = 18;

How to put data in asc or desc order

select * from table ORDERBY column name ; select * from table ORDERBY column name DESC;

How to select NULL values from table selecting 2 columns

select column1,column 2 FROM table WHERE column 2 IS NULL


Related study sets

What organelle would be abundant in the following cell types

View Set

ASVAB Automotive and Shop Information (2020)

View Set

Chapter 1, The Copernican Revolution

View Set

Parent Functions & Discontinuities

View Set

Chapter 5. States of Consciousness

View Set

AWS Module 1-10 Knowledge Checks

View Set