Database Access: SQL Queries - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Database Access: SQL Queries

Description:

Modifies one or more columns of one or more rows of a table. SQL DELETE statement ... Hank Aaron Stadium') 4. ITE 370: Database Access: SQL Queries ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 8
Provided by: jeffl9
Category:
Tags: sql | access | database | queries

less

Transcript and Presenter's Notes

Title: Database Access: SQL Queries


1
Database Access SQL Queries
  • SQL INSERT statement
  • Adds one or more rows to a table
  • SQL UPDATE statement
  • Modifies one or more columns of one or more rows
    of a table
  • SQL DELETE statement
  • Removes one or more rows from a table

2
SQL INSERT Statement
  • Syntax
  • INSERT INTO lttable namegt
  • (ltcolumn namegt,ltcolumn namegt)
  • VALUES (ltvaluegt,ltvaluegt)
  • Second line is optional
  • If you omit, then values list must be complete
    and in order of field creation
  • If you include column list, values list must
    match column list in number and order (but not in
    field creation order

3
INSERT Example
  • INSERT INTO Team (League, Location,
  • Nickname, Stadium)
  • VALUES (AL, Mobile, Bay Bears,
  • Hank Aaron Stadium)

4
SQL UPDATE statement
  • Syntax
  • UPDATE lttable namegt
  • SET ltset clause expressiongt , ltset clause
    expressiongt
  • WHERE ltsearch conditiongt
  • ltset clause expressiongt syntax
  • ltcolumn namegt ltvalue expressiongt
  • Omitting WHERE updates all rows

5
UPDATE Examples
  • UPDATE Team
  • SET StadiumCitizens Bank Park
  • WHERE StadiumVeterans Stadium
  • UPDATE Player
  • SET HRHR 1
  • WHERE PlayerId22

6
SQL Delete Statement
  • Syntax
  • DELETE FROM lttable namegt
  • WHERE ltsearch conditiongt
  • Omission of WHERE removes all rows

7
DELETE Examples
  • DELETE FROM Team
  • WHERE NicknameBay Bears
  • DELETE FROM Team
  • WHERE League NOT IN ('AL', 'NL')
Write a Comment
User Comments (0)
About PowerShow.com