Basic SQL Commands
Basic SQL Commands
BROUGHT TO YOU BY: JOHN RHEVIN GARCIA & JOHN CARLO PELACIO
SELECT
The SELECT statement is used to specify which
columns of a database table should be included in the
result.
Syntax:
SELECT movie_name, director
FROM films;
The WHERE clause filters rows that match a
WHERE-
certain condition.
Syntax:
DELETE FROM
WHERE movie_name films=‘Ameli
e';
Syntax:
DROP TABLE films;
UPDATE
UPDATE is used to change the values of individual cells in
an existing table. It is used with the SET keyword. This
example updates the director “J. Whedon”, to “Joss
Whedon”.
Syntax:
UPDATE films
SET director = "Joss Whedon" WHERE
director = "J. Whedon“;
DELETE
The DELETE statement is used to delete existing records in a
table.
Syntax:
DELETE FROM films
WHERE language='French';
INSERT INTO
The INSERT INTO statement is used to insert new
records in a table.
Syntax:
INSERT INTO films (moviename, director, revenue,
date, genre, language)
Syntax:
SELECT movie_name AS
movie_title FROM films;
ALTER TABLE
Modifies a table (e.g., adding/removing columns).
Syntax:
ALTER TABLE films
ADD COLUMN main_character ;
Syntax:
SELECT * FROM employees ORDER BY name ASC;