Download presentation
Presentation is loading. Please wait.
Published byRoberta Boone Modified over 9 years ago
1
SQL Basic
2
What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
3
What can you do with SQL? SQL enables you to select, insert, modify, and delete the information in a database; perform system security functions and set user permission on tables and databases; handle online transaction processing within an application, create store procedures and triggers to reduce application coding; and transfer data between different databases.
4
SQL Data Manipulation Language (DML) SQL (Structured Query Language) is a syntax for executing queries. SELECT - extracts data from a database table UPDATE - updates data in a database table DELETE - deletes data from a database table INSERT INTO - inserts new data into a database table
5
Selecting Data The select statement is used to query the database and retrieve selected data that match the criteria that you specify. Here is the format of a simple select statement: select "column1" [,"column2",etc] from "tablename" [where "condition"]; [ ] = optional
6
Inserting data into a Table The insert statement is used to insert or add a row of data into the table. insert into "tablename" (first_column,...last_column) values (first_value,...last_value);
7
Updating Records The update statement is used to update or change records that match a specified criteria. This is accomplished by carefully constructing a where clause. update "tablename” set "columnname" = "newvalue" [,"nextcolumn" = "newvalue2"...] where "columnname" OPERATOR "value" [and| or "column" OPERATOR "value"];
8
Deleting Records The delete statement is used to delete records or rows from the table. delete from "tablename" where "columnname" OPERATOR "value" [and|or "column" OPERATOR "value"];
9
Will this statement work? Select *
10
The FROM clause is missing Select * from [tablename]
11
If amount name payee are column names from tables check would this statement work Select amount name payee from checks
12
Select amount, name, payee from checks You need to have comma between each column name.
13
What is wrong with the following statement? Delete collection,
14
Delete from collections;
15
Is this correct Delete * from collections
16
Delete * from Collection No the * is not needed
17
Let’s take a quiz!!!!!
18
Answer to Quiz 1. Structured Query Language 2. Select 3. Update 4. Delete 5. Insert 6. Select Firstname from Persons 7. Select * from Persons 8. Select * from persons where firstname = “peter 9. Select * from persons where firstname like ‘a%’ 10. Update persons set lastname = ‘nilsen’ where lastname = ‘hansen’
19
Congratulations! You have just learned Basic SQL statements.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.