SQL

SELECT query

(asking for existing records)

SELECT * FROM Posts

* = all fields in table, so this was getting all fields from the posts table.

INSERT INTO (adding a brand new record)

INSERT INTO 
(title,content,tags) VALUES 
('this is a post','this is my post content','tag1,tag2,tag3,tag4')

UPDATE (changing an existing record)

UPDATE posts SET
field1 = 'value1',
field2 = 'value2',
field3 = 'value3'
WHERE id = 23

DELETE (deleting an existing record)

WHERE Clause

Only get the post information WHERE the id field equals 1

SELECT * FROM Posts WHERE id = 1

Leave a Reply

You must be logged in to post a comment.