0% found this document useful (0 votes)
2 views

Basic SQL Commands

This document outlines basic SQL commands including SELECT, WHERE, DELETE, DROP TABLE, UPDATE, INSERT INTO, AS, ALTER TABLE, and ORDER BY. Each command is accompanied by its syntax and a brief description of its function in managing database tables. The commands are essential for querying, modifying, and organizing data within a database.

Uploaded by

johnrhevin1
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Basic SQL Commands

This document outlines basic SQL commands including SELECT, WHERE, DELETE, DROP TABLE, UPDATE, INSERT INTO, AS, ALTER TABLE, and ORDER BY. Each command is accompanied by its syntax and a brief description of its function in managing database tables. The commands are essential for querying, modifying, and organizing data within a database.

Uploaded by

johnrhevin1
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

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';

DROP TABLE - Deletes a table

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)

VALUES (‘Amelie’, Jean Pierre


Jeunet’, ’174000000', ’2002', ’Drama’, ’French');
AS
To rename a column or a table when returning results, you
can use the AS command to set an alias for your outputs.

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 ;

ALTER TABLE films


DROP COLUMN date;
ORDER BY – Sorts the result set it can be ASCENDING or
DESCENDING

Syntax:
SELECT * FROM employees ORDER BY name ASC;

You might also like