CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.

Slides:



Advertisements
Similar presentations
1 Başar Öztayşi 2011 END 213E Data Processing in Industrial Systems SQL Structured Query Language.
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
Copyright © by Royal Institute of Information Technology Introduction To Structured Query Language (SQL) 1.
SQL Basics Based on the relational algebra we just learned. Nonprocedural language – what to be done not how Simple, powerful language Used for both data.
1ISM - © 2010 Houman Younessi Lecture 3 Convener: Houman Younessi Information Systems Spring 2011.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
Database Lecture # 1 By Ubaid Ullah.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Intro to JDBC To effectively use Java Data Base Connectivity we must understand: 1.Relational Database Management Systems (RDBMS) 2.JDBC Drivers 3.SQL.
LOGO 1 Lab_02: Basic SQL. 2 Outline  Database Tables  SQL Statements  Semicolon after SQL Statements?  SQL DML and DDL  SQL SELECT Statement  SQL.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
SQL Training SQL Statements – Part 1. Confidential & Proprietary Copyright © 2009 Cardinal Directions, Inc. Lesson Objectives Explain the role of SQL.
Structured Query Language. SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems.
Database A collection of related data. Database Applications Banking: all transactions Airlines: reservations, schedules Universities: registration, grades.
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Sundara Ram Matta Apr 01 st, Sundara Ram Matta Apr 01 st, 2015
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
1 What is database 2? What is normalization? What is SQL? What is transaction?
Structure Query Language SQL. Database Terminology Employee ID 3 3 Last name Small First name Tony 5 5 Smith James
Nitin Singh/AAO RTI ALLAHABAD 1 SQL Nitin Singh/AAO RTI ALLAHABAD 2 OBJECTIVES §What is SQL? §Types of SQL commands and their function §Query §Index.
BY SATHISH SQL Basic. Introduction The language Structured English Query Language (SEQUEL) was developed by IBM Corporation, Inc., to use Codd's model.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Getting to Know SQL. © Jim Hope 2002 All Rights Reserved Data Manipulation SELECT statement INSERT INTO statement UPDATE statement DELETE statement TRANSFORM.
SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan.
DAT602 Database Application Development Lecture 3 Review of SQL Language.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
5. Simple SQL using Oracle1 Simple SQL using Oracle 5. Working with Tables: Data management and Retrieval 6. Working with Tables: Functions and Grouping.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
SQL “Structured Query Language; standard language for relational data manipulation” DB2, SQL/DS, Oracle, INGRES, SYBASE, SQL Server, dBase/Win, Paradox,
SQL Structured Query Language 1. Data Definition Language (DDL) is used to manage table and define data structure i.e. CREATE, ALTER, DROP Data Control.
SQL. คำสั่ง SQL SQL stands for Structured Query Language is a standard language for accessing and manipulating databases.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
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,
Using SQL Connecting, Retrieving Data, Executing SQL Commands, … Svetlin Nakov Technical Trainer Software University
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Aliya Farheen October 29,2015.
WEEK# 12 Haifa Abulaiha November 02,
Chapter 11 Database and SQL. Flat Files and Databases Flat files Databases Advantages Efficient use of resources Access control Disadvantages Security.
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Manipulating Data Lesson 3. Objectives Queries The SELECT query to retrieve or extract data from one table, how to retrieve or extract data by using.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 5: SQL I Rob Gleasure robgleasure.com.
Introduction to Database SEM I, AY Department of Information Technology Salalah College of Technology Chapter No.3 SQL.
به نام خدا SQL QUIZ جوانمرد Website: ejavanmard.blogfa.com.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Simple Queries DBS301 – Week 1. Objectives Basic SELECT statement Computed columns Aliases Concatenation operator Use of DISTINCT to eliminate duplicates.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
SQL Structured Query Language. SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database.
COM621: Advanced Interactive Web Development Lecture 11 MySQL – Data Manipulation Language.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
Web Systems & Technologies
From: SQL From:
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Chapter 5 Introduction to SQL.
 2012 Pearson Education, Inc. All rights reserved.
Introduction to Structured Query Language(SQL)
JDBC.
Structured Query Language (SQL) William Klingelsmith
Introduction To Structured Query Language (SQL)
Access: SQL Participation Project
SQL Queries Chapter No 3.
Introduction To Structured Query Language (SQL)
Structured Query Language
The University of Akron College of Applied Science & Technology Dept
Presentation transcript:

CIS 375—Web App Dev II SQL

2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute queries, retrieve data, insert new records, delete records, and update records in a database. SQL works with database programs like MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase, etc. A database contains one or more ______. Each table is identified by a name and contains records (rows) and fields (columns). Besides W3Schools, you can also try (optional).

3 SQL Queries, DML, DDL Suppose a table named Persons has fields SSN, LastName, FirstName, Age, Address, City and has ten records. An SQL query: SELECT LastName FROM Persons Provides a list of all ten last names in the table SQL also has a DML (Data ___________ Language) to update, insert, and delete records. SQL also has a DDL (Data __________ Language) to do things like create and delete tables, and to create table indexes (________ keys). For example, SSN would be an index in Persons.

4 SQL: The SELECT Statement The SELECT statement specifies ________ of data to be returned from a table. Examples of SQL SELECT statements for the table Persons. SELECT LastName, FirstName FROM Persons (use a “,” to separate column names) SELECT * FROM Persons (* means “all”) Executing an SQL statement produces a ________ set of data. Some database programs require a “;” after each SQL statement, but many don’t.

5 SQL: SELECT DISTINCT A SELECT statement could possibly result in multiple values. Use DISTINCT to avoid this possibility. Example: Suppose you want a list of all distinct cities in the Persons table. SELECT DISTINCT City FROM Persons Without DISTINCT, the city of Springfield, for example, might appear several times in the list (for each person who lives in Springfield).

6 SQL: The WHERE Clause The WHERE clause specifies _____ of data to be returned from a table. Example of SQL WHERE clause. SELECT * FROM Persons WHERE City=‘Springfield’ (returns all fields for records where City is Springfield) Use quotes around text, but not around numbers. Other operators include <>, >, =, <=, __________, and LIKE. SELECT LastName, FirstName FROM Persons WHERE City BETWEEN ‘A’ AND ‘M’ SELECT * FROM Persons WHERE LastName LIKE ‘A%’ (returns all last names beginning with A)

7 SQL: INSERT INTO Statement To insert a new row into a table: INSERT INTO Persons VALUES (‘Bush', ‘George W.', 56, ‘1600 Pennsylvania Ave.', ‘Washington, D.C.') To insert only certain values in certain columns of a new row: INSERT INTO Persons (LastName, Address) VALUES (‘Hood', ‘Sherwood Forest')

8 SQL: UPDATE Statement To modify data in an existing row: UPDATE Persons SET FirstName = ‘Rick' WHERE LastName = ‘Johnson‘ Update several columns in a row: UPDATE Persons SET Address = 'Stien 12', City = 'Stavanger' WHERE LastName = 'Rasmussen'

9 SQL: DELETE Statement To delete one or more rows from a table: DELETE FROM Persons WHERE LastName = 'Rasmussen' To delete all rows: DELETE * FROM Persons

10 SQL: ORDER BY ORDER BY is used for _________ results of a query. Example: SELECT LastName, FirstName FROM Persons ORDER BY LastName Sort by multiple columns: SELECT * FROM Persons ORDER BY LastName, FirstName Sort in descending or ascending order: SELECT * FROM Persons ORDER BY City DESC, LastName ASC You can test your SQL skills with a real database at

11 SQL: AND, OR, NOT AND and OR are used to join conditions in a _______ clause. Examples: SELECT * FROM Persons WHERE LastName = ‘Johnson’ AND FirstName = ‘Richard’ SELECT * FROM Persons WHERE (FirstName='Tove' OR FirstName='Stephen') AND LastName='Svendson' You can also use the keyword _____ with many different kinds of SQL statements: SELECT * FROM Persons WHERE NOT (City=‘Berlin' OR City=‘London') SELECT LastName, FirstName FROM Persons WHERE City NOT BETWEEN ‘A’ AND ‘M’

12 SQL: COUNT Statement To count all rows in a table (‘*’ means no ________ specified): SELECT COUNT(*) FROM Persons Using COUNT with a WHERE clause: SELECT COUNT(*) FROM Persons WHERE Age>20 When a column is specified, the null entries are not counted: SELECT COUNT(Age) FROM Persons To count distinct entries in a particular column: SELECT COUNT(DISTINCT City) FROM Persons