Oct 2001 cylauFoxpro Chapter 91 Chapter 9 SQL Structural Query Language.

Slides:



Advertisements
Similar presentations
Basic SQL Introduction Presented by: Madhuri Bhogadi.
Advertisements

Virtual training week 4 structured query language (SQL)
Introduction to Structured Query Language (SQL)
Introduction to Oracle9i: SQL1 Basic SQL SELECT Statements.
Lab 7: Attribute SQL- Query the database
Introduction to Structured Query Language (SQL)
Microsoft Access 2010 Chapter 7 Using SQL.
WRITING BASIC SQL SELECT STATEMENTS Lecture 7 1. Outlines  SQL SELECT statement  Capabilities of SELECT statements  Basic SELECT statement  Selecting.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Chapter 2 Basic SQL SELECT Statements
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Chapter 9 SQL and RDBMS Part C. SQL Copyright 2005 Radian Publishing Co.
ASP.NET Programming with C# and SQL Server First Edition
Using SQL Queries to Insert, Update, Delete, and View Data Date Retrieval from a single table & Calculations © Abdou Illia MIS Spring 2015.
Relational DBs and SQL Designing Your Web Database (Ch. 8) → Creating and Working with a MySQL Database (Ch. 9, 10) 1.
Chapter 2 Basic SQL SELECT Statements Oracle 10g: SQL.
Chapter 10 Queries and Updating Part C. SQL Copyright 2005 Radian Publishing Co.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
Sept 2001 cylauFoxpro Chapter 61 Chapter 6 Searching Records in a Table.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Structure Query Language SQL. Database Terminology Employee ID 3 3 Last name Small First name Tony 5 5 Smith James
Single-Table Queries 1: Basics CS 320 Online. Review: SQL Command Types  Data Definition Language (DDL)  Used to create and modify database objects.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Using Special Operators (LIKE and IN)
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
SQL: Data Manipulation I Chapter 5 CIS 458 Sungchul Hong.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
SQL - DML. Data Manipulation Language(DML) Are used for managing data: –SELECT retrieve data from the a database –INSERT insert data into a table –UPDATE.
SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan.
Oracle & SQL Introduction. Database Concepts Revision DB? DBMS? DB Application? Application Programs? DBS? Examples of DBS? Examples of DBMS? 2Oracle.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
SQL. คำสั่ง SQL SQL stands for Structured Query Language is a standard language for accessing and manipulating databases.
Advanced SELECT Queries CS 146. Review: Retrieving Data From a Single Table Syntax: Limitation: Retrieves "raw" data Note the default formats… SELECT.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
Database Management System. DBMS A software package that allows users to create, retrieve and modify databases. A database is a collection of related.
CMPT 258 Database Systems The Relationship Model (Chapter 3)
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
Nov 2001 cylauFoxPro Chapter 101 Chapter 10 Conditions, Aggregate Functions and Groups.
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
SQL. Originally developed by IBM Standardized in 80’s by ANSI and ISO Language to access relational database and English-like non-procedural Predominant.
SQL constrains and keys. SORTED RESULTS Sort the results by a specified criterion SELECT columns FROM tables WHERE predicates ORDER BY column ASC/DESC;
Introduction to Database SEM I, AY Department of Information Technology Salalah College of Technology Chapter No.3 SQL.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Sept 2001 cylauFoxpro Chapter 41 Chapter 4 Accessing Database Tables.
1 SQL Chapter 9 – 8 th edition With help from Chapter 2 – 10 th edition.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Select Complex Queries Database Management Fundamentals LESSON 3.1b.
Oracle 10g Retrieving Data Using the SQL SELECT Statement.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Oracle & SQL Introduction
SQL Creating and Managing Tables
The University of Texas – Pan American
SQL Creating and Managing Tables
SQL Creating and Managing Tables
CIS16 Application Programming with Visual Basic
Introduction To Structured Query Language (SQL)
HAVING,INDEX,COMMIT & ROLLBACK
Introduction To Structured Query Language (SQL)
Chapter 8 Advanced SQL.
Presentation transcript:

Oct 2001 cylauFoxpro Chapter 91 Chapter 9 SQL Structural Query Language

Oct 2001 cylauFoxpro Chapter 92 Properties zSet-oriented database language zUsed to manipulate and retrieve data from relational database zNon-procedural language (what, not how) yA procedural language stresses on HOW. yA non-procedural language stresses on What. z4GL (Fourth Generation Language) zPowerful (a few commands can do lots of work)

Oct 2001 cylauFoxpro Chapter 93 Syntax zA simple subset of SQL SELECT (some fields)&& Not the SELECT in FoxPro FROM (a table) ORDER BY (some fields) TO (some place) zThe SQL command SELECT is not the same as the Foxpro command SELECT zSQL - SELECT is used for data retrieval zFoxpro - SELECT is used for choosing a work area

Oct 2001 cylauFoxpro Chapter 94 Example zFurther Practice 15 Q.3 SELECT * && all fields FROM payroll ORDER BY staff_id, year, month zTwo tables will be opened ythe table payroll ythe cursor

Oct 2001 cylauFoxpro Chapter 95 Cursor zThe result of a query is called a Cursor zA non-editable table zFor browsing or reporting zA browsing window appears when no TO clause or INTO clause is present

Oct 2001 cylauFoxpro Chapter 96 A Larger Subset of SQL SELECT [DISTINCT] fieldName1| expr1 [AS aliasName1] [, fieldName2| expr2 AS aliasName2] FROM tableName [ORDER BY fieldname1|aliasName1 [ASC|DESC] [fieldname1|aliasName1 [ASC|DESC]]] [TO SCREEN|TO PRINTER|TO textfile|INTO TABLE tablename] zItems inside […] may be omitted zchoice1 | choice2 | … | choiceN&& take ONE choice

Oct 2001 cylauFoxpro Chapter 97 Example zSTUDENT(class, no, name, house, result) 7A01ChanLove13.3 7A15LeeFaith13.8 7A09CheungWisdom12.9 7S38WongHope13.1 7S12HoFaith14.2

Oct 2001 cylauFoxpro Chapter 98 Select Individual Columns zSELECT name, class FROM student NameClass Chan7A Lee7A Cheung7A Wong7S Ho7S

Oct 2001 cylauFoxpro Chapter 99 Queries with Distinction SELECT DISTINCT house; FROM student;(Note the use of ‘;’) Faith Hope Love Wisdom (Note: the records are automatically sorted on house)

Oct 2001 cylauFoxpro Chapter 910 Order the Result of the Query zSELECT * FROM student Order by result ClassNoNameHouseResult 7A09CheungWisdom12.9 7S38WongHope13.1 7A01ChanLove13.3 7A15LeeFaith13.8 7S12HoFaith14.2

Oct 2001 cylauFoxpro Chapter 911 A Procedural Alternative USE student INDEX ON result TO student LIST z3 commands(one only for SQL) zstep by step is procedural (steps unknown in SQL) zKnow HOW to index, HOW to … (In SQL, give me WHAT is required)

Oct 2001 cylauFoxpro Chapter 912 Specifying alias for column SELECT name, house, result AS time; FROM student; ORDER BY time&& Not by result (key word AS can be omitted) NameHouseTime CheungWisdom12.9 WongHope13.1 ChanLove13.3 LeeFaith13.8 HoFaith14.2

Oct 2001 cylauFoxpro Chapter 913 Simple Expressions in Query zSELECT name, result old, result new; zFROM student ORDER BY new NameOldNew Cheung Wong Chan Lee Ho

Oct 2001 cylauFoxpro Chapter 914 Revision on Functions P Name is “Betty Au ”&& 1 space after Au zLen(name)9 zUPPER(name)BETTY AU zLOWER(name)betty au zLEFT(name,3)Bet zRIGHT(name,3)Au zALLTRIM(name)Betty Au zSUSTR(name, 1, at(‘ ‘,name)-1)Betty

Oct 2001 cylauFoxpro Chapter 915 Special Character Processing zSTR( , 8, 2) zVAL(‘5E2’) 5* zASC(‘A’)65 zCHR(97)‘a’ zLEN(‘ABC’)3

Oct 2001 cylauFoxpro Chapter 916 DateP.294 or P.56 Date is {09/11/2001} zDAY(date)11 zDOW(date)3 && Sunday=1st day zCDOW(date)Tuesday zMONTH(date)9 zCMONTH(date)September zYEAR(date)2001

Oct 2001 cylauFoxpro Chapter 917 Set Date, Century,... Date is {09/11/01} z?date09/11/1901 Set Century On 09/11/01Set Century Off z?CMONTH(date) ySeptemberdate is created after set date to American yNovemberdate is created after set date to British

Oct 2001 cylauFoxpro Chapter 918 Exercise Chapter 9, P. 299 z1, 2, 5 (Theory) z6, 7, 8(Warm Up) z10, 11, 12, 13, 14 TOO MUCH? Practice Makes Prefect Complete at least half before the next lesson