(Very, very basic) Introduction to SQL

CREATE TABLE Creates a table in the database.
CREATE TABLE departments
(
    dept#               NUMBER(2) NOT NULL,
    name                VARCHAR2(14),
    location            VARCHAR2(13)
);
Speaking of VARCHAR2, these are the main data types in Oracle:
  • CHAR
  • VARCHAR2
  • NUMBER
  • LONG
  • DATE
DROP TABLE Deletes a table from the database.
DROP TABLE departments;
INSERT Populates the database.
INSERT INTO departments VALUES (10,'ACCOUNTING','NEW YORK');
INSERT INTO departments VALUES (20,'RESEARCH','DALLAS');
INSERT INTO departments VALUES (30,'SALES','CHICAGO');
INSERT INTO departments VALUES (40,'OPERATIONS','BOSTON');
SELECT Displays data from the database.
SELECT name
    FROM departments;
SELECT dept#, name, location 
    FROM departments;
SELECT * 
    FROM departments;
UPDATE Modifies data in a table.
UPDATE departments
    SET location = 'PHILADELPHIA';
DELETE Removes a row or several rows from a table.
DELETE FROM departments;
WHERE Adds more power of SQL:
SELECT * 
    FROM departments
        WHERE name = 'SALES'
            OR name = 'RESEARCH'
;

UPDATE departments
    SET location = 'NEW ORLEANS'
        WHERE name = 'SALES'
            OR name = 'RESEARCH'
;
Of course, = is not the only operator.
SELECT * 
    FROM departments
        WHERE dept# <= 20
;

SELECT * 
    FROM departments
        WHERE name != 'RESEARCH'
;
For a complete list of operators and their prescedence, check the Oracle SQL reference, section on operators.