Você está na página 1de 12

 A program that

 Manages possibly huge quantities of data


 Facilitates fast and easy access
 Makes data integrity guarantees
 Has A LOT under the covers
 Applications
 Amazon.com, Facebook, IMDB, digg.com, banks, Google, etc

 Implementations
 MySQL, Postgre, Oracle, Microsoft SQL Server
 “In computer programming, create, read, update, and delete (CRUD)
are the four basic functions of persistent storage. Alternate words are
sometimes used when defining the four basic functions of CRUD, such
as retrieve instead of read, modify instead of update,
or destroy instead of delete. CRUD is also sometimes used to
describe user interface conventions that facilitate viewing, searching,
and changing information; often using computer-
based forms and reports. The term was likely first popularized
by James Martin in his 1983 book managing the Data-base
Environment. The acronym may be extended to CRUDL to
cover listing of large data sets which bring additional complexity
such as pagination when the data sets are too large to hold easily in
memory.”
 CRUD is an acronym that stands for Create, Read, Update,
and Delete.
 Create data in a table
 A new actor has just appeared in a film

 Read data from a table


 Somebody has searched for an actor

 Update data in a table


 An actor has appeared in a new movie

 Delete data in a table


 A planned movie is cancelled
 Syntax
INSERT INTO table_name (column1,coulmn2,column n)

VALUES (value1,value2,value n)

Examples:

 INSERT INTO student (last_name, fist_name) VALUES


(‘Ibrahim', ‘John');

 INSERT INTO student (`first_name`, `age`) VALUES ('John', 24),


('Jane', 22);
 Read (SELECT)
 Select specific Attribute from table(Syntax)
 SELECT Column_Name FROM Table_Name
 Select All Data From Table(Syntax)
 SELECT * FROM Tabel_Name
 Get all rows and only the id column from the “STUDENT ” table
SELECT id
FROM student;

 Get all rows and columns from the “STUDENT” table


SELECT *
FROM student;

 Get all rows and columns from the “USER” table whose name field is “Tom Cruise.”
SELECT *
FROM user
WHERE first_name = ‘Ibrahim’;

 Get all rows and columns from the “USER” table whose name field is either “Ibrahim”
or “Katie Holmes.”
SELECT *
FROM user
WHERE name = ‘Ibrahim’
OR name = ‘Katie Holmes’’;
Syntax
UPDATE FROM table_name
SET Attribute_Name=New_Value
WHERE column_name=value;

 Change Ibrahim’s gender


UPDATE student
SET gender = ‘F’
WHERE name = ‘Ibrahim’;

 Change Ibrahim’s gender if he is a man


UPDATE student
SET gender = ‘F’
WHERE name = ‘Ibrahim’
AND gender = ‘M’;
 Syntax
DELETE FROM table_name
WHERE column_name=value;

 Delete John from the STUDENT


DELETE FROM student
WHERE first_name = ‘John’;
• Delete Jane From the STUDENT
DELETE FROM students
WHERE last_name = 'Jane';

Você também pode gostar