Download presentation
Presentation is loading. Please wait.
Published byDenis Perkins Modified over 9 years ago
1
SQL FIS 1311 Nov. 28, 2005
2
Structured Query Language ANSI/ISO standard; used with relational databases Is a very simple but powerful computer language: –Tells the computer/database “what to do” –Sequences of linked commands can perform complex tasks –Represents a formalized language that utilizes: datatypes, boolean operators
3
Structured Query Language, Con’t What can it do? –Define, very precisely, the retrieval of information from relational databases –Insert and update data in these databases –Create and define tables –Perform elementary analysis/manipulation of retrieved results –Viewing/formatting data in different ways
4
Anatomy of a select statment SELECT: describe fields you want to see/retrieve FROM: table(s) where the fields are found WHERE: describe one or more conditions that will restrict the number of fields retrieved Display information: ORDER BY, Remove duplicates
5
WHERE - Conditions = Equal <> or !=Not Equal < Less Than > Greater Than <= Less Than or Equal To >= Greater Than or Equal To
6
WHERE - Conditions, con’t IN Allows the user to supply a list of values as conditions in a query. (Could be either numeric or textual, but are generally textual) BETWEEN Allows the user to select a range of values as a query condition. (Tends to be numeric.) LIKE Used with the % sign, which can stand in for any character or set of characters
7
Dataypes Individual fields can/will have different datatypes. These are important in SQL syntax in conditional, “when” clauses: –If it’s text, use single quotes: WHEN last_name=‘friesen’; like ‘%norm%’ –If it’s numeric, don’t use quotes: WHEN ID > 5 –Numbers or combinations of numbers and other characters can be used and ordered, etc. as text datatypes
8
Practice, Practice… learningspaces.org/1311/sql/select-1.cfm Use this, and see what happens!
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.