SlideServe
Menu
Préférences
© SlideServe · v2026

SQL Queries

xaria avatar
19 diapositives · 3K Views · Jul 21, 2014

SQL Queries. Chapter No 3. Introduction . SQL stands for Structured Query Language Access and Manipulate Database SQL is an ANSI Standard SQL is not Case Sensitive Supports a set of commands that can perform common operations over a database Works with MS Access, SQL Server, MySql

SQL Queries - slide 1
01 / 19SQL Queries
1 / 17

Télécharger la présentation

SQL Queries
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. SQL Queries Chapter No 3

  2. Introduction • SQL stands for Structured Query Language • Access and Manipulate Database • SQL is an ANSI Standard • SQL is not Case Sensitive • Supports a set of commands that can perform common operations over a database • Works with MS Access, SQL Server, MySql • With Scripting languages like PHP • Works with HTML and ASP

  3. Operations • SQL can retrieve data from a database • SQL can insert records in a database • SQL can update records in a database • SQL can delete records from a database • SQL can create new databases • SQL can create new tables in a database • SQL can create views in a database • SQL can set permissions on tables, procedures, and views

  4. SQL Organization • SQL can be divided into three parts • RDML • RDDL • RDCL • Relational Data Manipulation Language • Relational Data Definition Language • Relational Data Control Language

  5. DML Commands • INSERT INTO - inserts new data into a database • SELECT - extracts data from a database • UPDATE - updates data in a database • DELETE - deletes data from a database

  6. DDL Commands • CREATE DATABASE - creates a new database • ALTER DATABASE - modifies a database • CREATE TABLE - creates a new table • ALTER TABLE - modifies a table • DROP TABLE - deletes a table

  7. SELECT Statement • SELECT column_name(s) FROM table_name • SELECT * FROM table_name • SELECT LastName,FirstName FROM Persons • SELECT * FROM Persons

  8. SQL WHERE Syntax • SELECT column_name(s) FROM table_name WHERE column_name operator value • SELECT * FROM Persons WHERE City='Sandnes‘ • This is correct: • SELECT * FROM Persons WHERE FirstName='Tove‘ • This is wrong: • SELECT * FROM Persons WHERE FirstName=Tove

  9. Operators Allowed in the WHERE Clause

  10. LIKE Syntax • SELECT column_name(s) FROM table_name WHERE column_name LIKE pattern • We want to select the persons living in a city that ends with an "s" from the "Persons" table. • SELECT * FROM Persons WHERE City LIKE ‘%s‘

  11. We want to select the persons living in a city that contains the pattern "tav" from the "Persons" table. • SELECT * FROM Persons WHERE City LIKE '%tav%'

  12. NOT Like • Select the persons living in a city that NOT contains the pattern "tav" from the "Persons" table, by using the NOT keyword. • SELECT * FROM Persons WHERE City NOT LIKE '%tav%‘

  13. INSERT Statement • INSERT INTO table_nameVALUES (value1, value2, value3,...) • INSERT INTO Persons VALUES (4,'Nilsen', 'Johan', 'Bakken 2', 'Stavanger')

  14. UPDATE Statement • The UPDATE statement is used to update existing records in a table. • UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value • UPDATE Persons SET Address='Nissestien 67', City='Sandnes' WHERE LastName='Tjessem' AND FirstName='Jakob'

  15. DELETE Statement • DELETE FROM table_name WHERE some_column=some_value • DELETE FROM Persons WHERE LastName='Tjessem' AND FirstName='Jakob‘ • Delete All Rows • DELETE FROM table_name • Or • DELETE * FROM table_name

  16. References • http://www.w3schools.com/SQL/default.asp • http://sqlzoo.net/1_2.htm • Database system by Thomas Connolly