1.3.2d SQL Flashcards
1
Q
How do you insert data into a table using SQL?
A
INSERT INTO (field1, field2, field3 , ...) VALUES ("value1", "value2", "value3", ...)
2
Q
How do you delete records from a database using SQL?
A
DELETE FROM (tablename) WHERE (fieldname) = ("condition")
3
Q
How do you update records from a database using SQL?
A
UPDATE (tablename)
SET (headingY = “value”)
WHERE (headingX = “condition”)
4
Q
How would you select all records that begin with an A?
A
SELECT (fieldname1, fieldname2, …)
FROM (tablename)
WHERE (fieldname) LIKE A%
5
Q
How would you join 2 tables together?
A
Use a common fieldname in both tables:
JOIN (fieldname)
ON (1tablename.field = 2tablename.field)
WHERE (tablename.field = “value”)
6
Q
How would you delete a table from SQL?
A
DROP TABLE (tablename)