CRUD Flashcards
Create, Read, Update and Delete Commands
1
Q
Inserts a new record in the “Customers” table with name as “Darren McBride” and age as 29
A
INSERT INTO Customers (name, age)
VALUES (“Darren McBride”, 29)
2
Q
Updates the first customer (CustomerID = 1) with a new contact person and a new city
A
UPDATE Customers
SET ContactName = ‘Alfred Sharpe’, City=’Frankfurt’
WHERE CustomerID = 1
3
Q
Update the contactname to “Juan” for all records where country is “Mexico”
A
UPDATE Customers
SET ContactName = “Juan”
WHERE Country = “Mexico”
4
Q
Delete the customer “Alfreds Futterkiste” from the “Customers” table
A
DELETE FROM Customers
WHERE CustomerName = “Alfreds Futterkiste”
5
Q
Delete all rows in the “Customers” table, without deleting the table
A
DELETE FROM Customers