SQL Key Revision Points.

Slides:



Advertisements
Similar presentations
Structured Query Language (SQL)
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
Structured Query Language Part I Chapter Three CIS 218.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 7 Introduction to Structured Query Language (SQL)
Microsoft Access 2010 Chapter 7 Using SQL.
CORE 2: Information systems and Databases STORAGE & RETRIEVAL 2 : SEARCHING, SELECTING & SORTING.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
Using SQL Queries to Insert, Update, Delete, and View Data Date Retrieval from a single table & Calculations © Abdou Illia MIS Spring 2015.
Chapter 10 Queries and Updating Part C. SQL Copyright 2005 Radian Publishing Co.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Microsoft Access 2010 Chapter 7 Using SQL. Change the font or font size for SQL queries Create SQL queries Include fields in SQL queries Include simple.
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.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
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
Using Special Operators (LIKE and IN)
Databases: An Overview Chapter 7, Exploring the Digital Domain.
SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
Database Management System. DBMS A software package that allows users to create, retrieve and modify databases. A database is a collection of related.
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
IS6146 Databases for Management Information Systems Lecture 1: Introduction to IS6146 Rob Gleasure robgleasure.com.
WEEK# 12 Haifa Abulaiha November 02,
SQL. Originally developed by IBM Standardized in 80’s by ANSI and ISO Language to access relational database and English-like non-procedural Predominant.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
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
ORDER BY Clause The result of a query can be sorted in ascending or descending order using the optional ORDER BY clause. The simplest form of.
Web Systems & Technologies
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Query Methods Simple SQL Statements Start ….
SQL Query Getting to the data ……..
Chapter 5 Introduction to SQL.
Query Methods Where Clauses Start ….
Query Methods Where Clauses Start ….
Access Maintaining and Querying a Database
MS Access: Creating Advanced Queries
Indices.
ATS Application Programming: Java Programming
Objectives Create an action query to create a table
Microsoft Office Illustrated Fundamentals
SQL FUNDAMENTALS CDSE Days 2018.
SQL 101.
Structured Query Language (SQL) William Klingelsmith
Chapter 7 Working with Databases and MySQL
Database Queries.
Chapter 8 Working with Databases and MySQL
CIS16 Application Programming with Visual Basic
Chapter # 7 Introduction to Structured Query Language (SQL) Part II.
Chapter 13 Subqueries and Views
Introduction To Structured Query Language (SQL)
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
Access: SQL Participation Project
Database Design and Development
Chapter 7 Introduction to Structured Query Language (SQL)
HAVING,INDEX,COMMIT & ROLLBACK
Structured Query Language – The Fundamentals
Introduction To Structured Query Language (SQL)
Databases Continued 10/18/05.
Do it now – PAGE 10 You will find your do it now task in your workbook – look for the start button! Sunday, 28 April 2019.
Shelly Cashman: Microsoft Access 2016
Tutorial 9 Using Action Queries and Advanced Table Relationships
Presentation transcript:

SQL Key Revision Points

SQL SQL (Structured Query language) pronounced “sequel” Declarative language consisting of commands called SQL statements Statements usually written in CAPS Statements contain clauses – individual commands Can create, update, query databases using SQL

SELECT (SELECT…FROM…WHERE) The SELECT clause is used to query (search) the database It SELECTS the records matching the criteria you specify

SELECT - Basic SELECT * FROM dogs SELECT dogName FROM dogs Returns all the data from all the records in the table called dogs (uses a wildcard) SELECT dogName FROM dogs Returns just the name for all the records in the table called dogs SELECT dogName, dogBreed, Age FROM dogs Returns the name, breed and age for all the records in the table called dogs

SELECT - Advanced Records can be filtered using arithmetic and Boolean operators SELECT dogName, Age FROM dogs WHERE Age <=5 SELECT dogName FROM dogs WHERE dogBreed=“Jack Russell” SELECT dogName, dogColour FROM dogs WHERE Age<5 OR dogBreed=“Chihuahua” SELECT dogName, dogColour FROM dogs WHERE dogName=“Killer” AND dogBreed=“Chihuahua” Syntax in the WHERE clause the same as used in Python if/while statements i.e. standard arithmetic and Boolean operators

SELECT Syntax Note from previous examples that syntax is always the same: SELECT dogName, dogColour FROM dogs WHERE Age<5 OR dogBreed=“Chihuahua” What to fields to display in the results Table containing the data Criteria or conditions

INSERT (INSERT INTO…VALUES) INSERT clause used to ADD records to an existing database

INSERT - Basic INSERT INTO dogs VALUES (“Psycho”, “Poodle”, “Grey”, 5) Inserts the record into the dogs table

INSERT – Advanced/Syntax If you want to add a partial record i.e. not all the fields you must also specify the field names after the table name INSERT INTO dogs(dogName, age) VALUES (“Mr Fluffy”,4) Which table/fields to insert data into What data to insert into these fields* * Must have the same number of fields/values and must be in the same order

UPDATE (UPDATE…SET…WHERE) UPDATE clause used to change existing records in a database table.

UPDATE - Basic UPDATE dogs SET dogName=“Mr. Fuzzychops” WHERE dogName=“Bert” Changes Bert’s name to Mr. Fuzzychops UPDATE dogs SET dogName=“Jason Bieber” WHERE dogID=5 Dog #5’s name is set to Jason Bieber UPDATE dogs SET dogBreed=“Old Dog” WHERE age>10 AND dogBreed=“Alsatiopoodle” Boolean in where clause may change multiple records i.e. all alsatiopoodles over 10 years old

UPDATE - Syntax Syntax always the same UPDATE dogs SET dogBreed=“Old Dog” WHERE age>10 AND dogBreed=“Alsatiopoodle” Table containing existing data Field to change and new data Criteria used to select the records to be changes

Sorting You can sort the results of a SELECT query using an ORDER BY clause SELECT dogName, dogColour FROM dogs WHERE Age<5 OR dogBreed=“Chihuahua” ORDER BY dogName ASC Use ASC to sort A-Z, 0-9 etc. Use DESC to sort Z-A, 9-0 etc.

Indexing (Create Index…On) To add a named index CREATE INDEX dogIndex ON dogs(dogName)

Textbook Textbook pages 52, 53, 56