SQL

A SQL query walks into a bar and ask two tables, "Can I join you?"

Language used to speak to almost any kind of database.

SELECT data to view

Basic selection where we pick all the rows from the npc table.

# select all the rows from the npc table.

SELECT * FROM npc

# Order all the npc's by the column hitpoint in descending order.

SELECT * FROM npc ORDER BY hitpoints DESC

# Get the 20 npc's with the highest hitpoints.

SELECT TOP 20 * FROM npc ORDER BY hitpoints DESC

UPDATE changed data

# Change the name of any npc namned Eggus

UPDATE Customers SET FirstName='Elric', LastName='Mellis' WHERE FirstName='Eggus'

DELETE something

# Delete all evil npc's

DELETE * FROM npc where aligment='evil'

# Delete all npc's

DELETE * FROM npc

INSERT something into the database

Reference