sql queries n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
SQL Queries PowerPoint Presentation
Download Presentation
SQL Queries

Loading in 2 Seconds...

play fullscreen
1 / 19

SQL Queries - PowerPoint PPT Presentation


  • 136 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'SQL Queries' - xaria


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
sql queries

SQL Queries

Chapter No 3

introduction
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
operations
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
sql organization
SQL Organization
  • SQL can be divided into three parts
    • RDML
    • RDDL
    • RDCL
  • Relational Data Manipulation Language
  • Relational Data Definition Language
  • Relational Data Control Language
dml commands
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
ddl commands
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
select statement
SELECT Statement
  • SELECT column_name(s) FROM table_name
  • SELECT * FROM table_name
  • SELECT LastName,FirstName FROM Persons
  • SELECT * FROM Persons
slide9

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
like syntax
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‘
slide12

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%'
not like
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%‘
insert statement
INSERT Statement
  • INSERT INTO table_nameVALUES (value1, value2, value3,...)
  • INSERT INTO Persons VALUES (4,'Nilsen', 'Johan', 'Bakken 2', 'Stavanger')
update statement
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'
delete statement
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
references
References
  • http://www.w3schools.com/SQL/default.asp
  • http://sqlzoo.net/1_2.htm
  • Database system by Thomas Connolly