SQL 101 – Class 1 Lee Turner. Agenda 1. This is your life – SQL A brief history of SQL What SQL is and what it is not Normalization 2. Some Super Simple.

Slides:



Advertisements
Similar presentations
Chapter 4 Joining Multiple Tables
Advertisements

CIT 613: Relational Database Development using SQL Introduction to SQL.
Structure Query Language (SQL) COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
Introduction to Structured Query Language (SQL)
Introduction to Structured Query Language (SQL)
CSE 190: Internet E-Commerce Lecture 10: Data Tier.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 8 Advanced SQL.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
30-Jun-15 SQL A Brief Introduction. SQL SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell”
Introduction to Structured Query Language (SQL)
Information systems and databases Database information systems Read the textbook: Chapter 2: Information systems and databases FOR MORE INFO...
® IBM Software Group © 2006 IBM Corporation The Eclipse Data Perspective and Database Explorer This section describes how to use the Eclipse Data Perspective,
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
ASP.NET Programming with C# and SQL Server First Edition
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Chapter 6: Introduction to SQL
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Introduction to SQL.
CHAPTER 6: INTRODUCTION TO SQL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 UNIT 6: Chapter 7: Introduction to SQL Modern Database Management 9 th Edition Jeffrey A.
Computer Science 101 Database Concepts. Database Collection of related data Models real world “universe” Reflects changes Specific purposes and audience.
Chapter 9 Joining Data from Multiple Tables
Oracle Database Administration Lecture 2 SQL language.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
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)
Concepts of Database Management Seventh Edition
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Chapter 6 © 2013 Pearson Education, Inc. Publishing as Prentice Hall Chapter 6: Introduction to SQL Modern Database Management 11 th Edition Jeffrey A.
Component 4/Unit 6c Topic III Structured Query Language Background information What can SQL do? How is SQL executed? SQL statement characteristics What.
CS146 References: ORACLE 9i PROGRAMMING A Primer Rajshekhar Sunderraman
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
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,
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
SqlExam1Review.ppt EXAM - 1. SQL stands for -- Structured Query Language Putting a manual database on a computer ensures? Data is more current Data is.
CIT 613: Relational Database Development using SQL Introduction to SQL DeSiaMorePowered by DeSiaMore 1.
(SQL - Structured Query Language)
INFANL01-3 ANALYSE 3 WEEK 3 March 2015 Institute voor Communication, Media en Informatietechnology.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
SQL. Originally developed by IBM Standardized in 80’s by ANSI and ISO Language to access relational database and English-like non-procedural Predominant.
1 A Very Brief Introduction to Relational Databases.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 5: SQL I Rob Gleasure robgleasure.com.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
CSC314 DAY 8 Introduction to SQL 1. Chapter 6 © 2013 Pearson Education, Inc. Publishing as Prentice Hall SQL OVERVIEW  Structured Query Language  The.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 6: INTRODUCTION.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
 MySQL  DDL ◦ Create ◦ Alter  DML ◦ Insert ◦ Select ◦ Update ◦ Delete  DDL(again) ◦ Drop ◦ Truncate.
LEC-8 SQL. Indexes The CREATE INDEX statement is used to create indexes in tables. Indexes allow the database application to find data fast; without reading.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
SQL Introduction SQL stands for “Structured Query Language” and can be pronounced as “SQL” or “sequel – (Structured English.
CHAPTER 7 DATABASE ACCESS THROUGH WEB
More SQL: Complex Queries,
Database Systems: Design, Implementation, and Management Tenth Edition
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
SQL 101.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Introduction To Structured Query Language (SQL)
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
SQL Fundamentals in Three Hours
Introduction To Structured Query Language (SQL)
Contents Preface I Introduction Lesson Objectives I-2
Database Systems: Design, Implementation, and Management Tenth Edition
Presentation transcript:

SQL 101 – Class 1 Lee Turner

Agenda 1. This is your life – SQL A brief history of SQL What SQL is and what it is not Normalization 2. Some Super Simple Selection Strategies Create a simple table Create a simple select query 3. Just a Rebel without a Where Clause Using simple where clauses to filter results Examining more complex where clauses 4. A SQL Query walks up to two tables in a restaurant and says: “Mind if I join you?” Inner Joins Outer Joins

This is your life - SQL SQL (Pronounced “si kwel”) stands for Structured Query Language. It is a special- purpose programming language designed for managing data held in a relational database management system (RDBMS). Initially developed in the early 1970s by IBM, it was picked up by Relational Software, Inc. (now Oracle Corporation) and offered commercially in 1979 as Oracle V2. SQL was one of the first commercial languages to use the relational model and has become the most widely used database language. SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987.[12] Since then, the standard has been enhanced several times with added features. Despite these standards, code is not completely portable among different database systems, which can lead to vendor lock-in. The different makers do not perfectly adhere to the standard, for instance by adding extensions, and the standard itself is sometimes ambiguous. Source:

What SQL Is and Is Not Computer Language Considered a 4GL Data Definition Data Manipulation Standard Vendors typically deviate from the standard slightly. Language that is pretty simple to grasp the basics, yet capable of performing very complex tasks. SQL Is ASQL Is Not A program owned by any one company. The only way to retrieve data. Synonymous with “Relational”

Normalization A relational database stores data in tables that “relate” to other tables. For instance you may have a customer table with information about your customer and an orders table with information about your orders. Within the orders table there is a field that contains the “Customer ID” relating the orders table back to the customer table. The purpose of normalization is to reduce redundant data within the database. Normalized databases typically have fewer data integrity issues, faster index creation and updates as well improved database locking.

CREATE A SIMPLE TABLE Go to Database, right-click on “Tables” and select “New Table” Click “New Query” Type Table DDL statement For now, lets stick with int and varchar data types. We will pick up more in future classes. Identity – Automagically created sequential number that ensures every record has a unique value (kinda:) Click on “New Query” Type in Select statement “Select * from Foo;” Select “Query”, “Design Query In Editor…” Right-Click on Table “Select Top 1000 Rows” “Edit Top 200 Rows” CREATE A SIMPLE QUERY Some Super Simple Select Strategies

Just a Rebel without a Where Clause Predicates =, <>, >, >=, <, <=, IN, BETWEEN, LIKE, IS NULL or IS NOT NULL Simple “Select * from Foo where customer_name = ‘Google’;” “Select * from Foo where customer_name LIKE ‘Goo%’;” The Where clause is used to limit the returned results to only those that meet a specific criteria. Complex - The keywords AND and OR can be used to combine two predicates into a new one. If multiple combinations are applied, parentheses can be used to group combinations to indicate the order of evaluation. Without parentheses, the AND operator has a stronger binding than OR.

Table Joins The SQL JOIN clause is used to join two or more tables using a common field between them. A JOIN can either be an “INNER” or “OUTER” (Just like belly buttons! :) INNER – Only rows that match up. This may bite you when you are doing analysis. OUTER – Left – Returns all rows from the left table, and matched rows from the right. Right – Returns all rows from the right table, and matched rows from the left. Full – Return all rows when there is a match in one of the tables.