Brad Lloyd & Michelle Zukowski 1 Design and Implementation CIS 400 Final Project Dr. Bruce Maxim SQL.

Slides:



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

CIT 613: Relational Database Development using SQL Introduction to SQL.
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
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”
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
CSC 2720 Building Web Applications Database and SQL.
SQL Overview Defining a Schema CPSC 315 – Programming Studio Spring 2008 Project 1, Lecture 3 Slides adapted from those used by Jeffrey Ullman, via Jennifer.
Structured Query Language SQL: An Introduction. SQL (Pronounced S.Q.L) The standard user and application program interface to a relational database is.
Information systems and databases Database information systems Read the textbook: Chapter 2: Information systems and databases FOR MORE INFO...
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
SQL Overview Defining a Schema CPSC 315 – Programming Studio Slides adapted from those used by Jeffrey Ullman, via Jennifer Welch Via Yoonsuck Choe.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
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.
Chapter 9 SQL and RDBMS Part C. SQL Copyright 2005 Radian Publishing Co.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
ASP.NET Programming with C# and SQL Server First Edition
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
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.
 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.
Introduction to SQL Steve Perry
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
1 Working with MS SQL Server Textbook Chapter 14.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
Introduction to MySQL Lab no. 10 Advance Database Management System.
Database Fred Durao What is a database? A database is any organized collection of data. Some examples of databases you may encounter in.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
Pavel Titenkov © SQL. Pavel Titenkov © Общий обзор англ. Structured Query Language — «язык структурированных запросов»англ. Это наиболее часто используемый.
D R. E.F.C ODD ’ S R ULES FOR RDBMS Dr. E.F.Codd is an IBM researcher who first developed the relational data model in 1970.Dr. Codd published a list.
Visual Programing SQL Overview Section 1.
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,
CIT 613: Relational Database Development using SQL Introduction to SQL DeSiaMorePowered by DeSiaMore 1.
>> Introduction to MySQL. Introduction Structured Query Language (SQL) – Standard Database Language – Manage Data in a DBMS (Database Management System)
IS6146 Databases for Management Information Systems Lecture 3: SQL III – The DDL Rob Gleasure robgleasure.com.
1 A Very Brief Introduction to Relational Databases.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
1 Section 10 - Embedded SQL u Many computer languages allow you to embed SQL statements within the code (e.g. COBOL, PowerBuilder, C++, PL/SQL, etc.) u.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Programming Constructs
Fundamentals of DBMS Notes-1.
CS SQL.
CS 3630 Database Design and Implementation
Chapter 5 Introduction to SQL.
Insert, Update and the rest…
Current outstanding balance
Introduction to Oracle9i: SQL
Design and Implementation
Chapter 2 Database Environment.
SQL OVERVIEW DEFINING A SCHEMA
Design and Implementation
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Structured Query Language Path from Unorganized to Organized….
Presentation transcript:

Brad Lloyd & Michelle Zukowski 1 Design and Implementation CIS 400 Final Project Dr. Bruce Maxim SQL

Brad Lloyd & Michelle Zukowski 2 An Overview of SQL SQL stands for Structured Query Language.SQL stands for Structured Query Language. It is the most commonly used relational database language today.It is the most commonly used relational database language today. SQL works with a variety of different fourth- generation (4GL) programming languages, such as Visual Basic.SQL works with a variety of different fourth- generation (4GL) programming languages, such as Visual Basic. SQL

Brad Lloyd & Michelle Zukowski 3 SQL is used for: Data ManipulationData Manipulation Data DefinitionData Definition Data AdministrationData Administration All are expressed as an SQL statement or command.All are expressed as an SQL statement or command. SQL

Brad Lloyd & Michelle Zukowski 4 SQL Requirements SQL Must be embedded in a programming language, or used with a 4GL like VBSQL Must be embedded in a programming language, or used with a 4GL like VB SQL is a free form language so there is no limit to the the number of words per line or fixed line break.SQL is a free form language so there is no limit to the the number of words per line or fixed line break. Syntax statements, words or phrases are always in lower case; keywords are in uppercase.Syntax statements, words or phrases are always in lower case; keywords are in uppercase. SQL Not all versions are case sensitive!

Brad Lloyd & Michelle Zukowski 5 SQL is a Relational Database Represent all info in database as tablesRepresent all info in database as tables Keep logical representation of data independent from its physical storage characteristicsKeep logical representation of data independent from its physical storage characteristics Use one high-level language for structuring, querying, and changing info in the databaseUse one high-level language for structuring, querying, and changing info in the database Support the main relational operationsSupport the main relational operations Support alternate ways of looking at data in tablesSupport alternate ways of looking at data in tables Provide a method for differentiating between unknown values and nulls (zero or blank)Provide a method for differentiating between unknown values and nulls (zero or blank) Support Mechanisms for integrity, authorization, transactions, and recoverySupport Mechanisms for integrity, authorization, transactions, and recovery A Fully Relational Database Management System must:

Brad Lloyd & Michelle Zukowski 6 Design SQL represents all information in the form of tables Supports three relational operations: selection, projection, and join. These are for specifying exactly what data you want to display or use SQL is used for data manipulation, definition and administration SQL

Brad Lloyd & Michelle Zukowski 7 Rows describe the Occurrence of an Entity Table Design SQL NameAddress Jane Doe123 Main Street John Smith456 Second Street Mary Poe789 Third Ave Columns describe one characteristic of the entity

Brad Lloyd & Michelle Zukowski 8 Data Retrieval (Queries) Queries search the database, fetch info, and display it. This is done using the keywordQueries search the database, fetch info, and display it. This is done using the keyword SELECT SELECT * FROM publishers pub_idpub_nameaddressstate 0736New Age Books1 1 st StreetMA 0987Binnet & Hardley2 2 nd StreetDC 1120Algodata Infosys3 3 rd StreetCA The * Operator asks for every column in the table.The * Operator asks for every column in the table.

Brad Lloyd & Michelle Zukowski 9 Data Retrieval (Queries) Queries can be more specific with a few more linesQueries can be more specific with a few more lines pub_idpub_nameaddressstate 0736New Age Books1 1 st StreetMA 0987Binnet & Hardley2 2 nd StreetDC 1120Algodata Infosys3 3 rd StreetCA Only publishers in CA are displayedOnly publishers in CA are displayed SELECT * from publishers where state = ‘CA’

Brad Lloyd & Michelle Zukowski 10 Data Input Putting data into a table is accomplished using the keywordPutting data into a table is accomplished using the keyword INSERT pub_idpub_nameaddressstate 0736New Age Books1 1 st StreetMA 0987Binnet & Hardley2 2 nd StreetDC 1120Algodata Infosys3 3 rd StreetCA Table is updated with new informationTable is updated with new information INSERT INTO publishers VALUES (‘0010’, ‘pragmatics’, ‘4 4th Ln’, ‘chicago’, ‘il’) pub_idpub_nameaddressstate 0010Pragmatics4 4 th LnIL 0736New Age Books1 1 st StreetMA 0987Binnet & Hardley2 2 nd StreetDC 1120Algodata Infosys3 3 rd StreetCA Keyword Variable

Brad Lloyd & Michelle Zukowski 11 pub_idpub_nameaddressstate 0010Pragmatics4 4 th LnIL 0736New Age Books1 1 st StreetMA 0987Binnet & Hardley2 2 nd StreetDC 1120Algodata Infosys3 3 rd StreetCA Types of Tables User Tables: contain information that is the database management systemUser Tables: contain information that is the database management system System Tables: contain the database description, kept up to date by DBMS itselfSystem Tables: contain the database description, kept up to date by DBMS itself There are two types of tables which make up a relational database in SQL RelationTable TupleRow AttributeColumn

Brad Lloyd & Michelle Zukowski 12 Using SQL SQL statements can be embedded into a program (cgi or perl script, Visual Basic, MS Access) OR OR SQL Database SQL statements can be entered directly at the command prompt of the SQL software being used (such as mySQL)

Brad Lloyd & Michelle Zukowski 13 Using SQL To begin, you must first CREATE a database using the following SQL statement: CREATE DATABASE database_name Depending on the version of SQL being used the following statement is needed to begin using the database: USE database_name

Brad Lloyd & Michelle Zukowski 14 Using SQL To create a table in the current database, use the CREATE TABLE keyword CREATE TABLE authors (auth_id int(9) not null, auth_name char(40) not null) auth_idauth_name (9 digit int)(40 char string)

Brad Lloyd & Michelle Zukowski 15 Using SQL To insert data in the current table, use the keyword INSERT INTO auth_idauth_name Then issue the statement SELECT * FROM authors INSERT INTO authors values(‘ ’, ‘John Smith’) John Smith

Brad Lloyd & Michelle Zukowski 16 Using SQL SELECT auth_name, auth_city FROM publishers auth_idauth_nameauth_cityauth_state Jane DoeDearbornMI John SmithTaylorMI auth_nameauth_city Jane DoeDearborn John SmithTaylor If you only want to display the author’s name and city from the following table:

Brad Lloyd & Michelle Zukowski 17 Using SQL DELETE from authors WHERE auth_name=‘John Smith’ auth_idauth_nameauth_cityauth_state Jane DoeDearbornMI John SmithTaylorMI To delete data from a table, use the DELETE statement:

Brad Lloyd & Michelle Zukowski 18 Using SQL UPDATE authors SET auth_name=‘hello’ auth_idauth_nameauth_cityauth_state Jane DoeDearbornMI John SmithTaylorMI To Update information in a database use the UPDATE keyword Hello Sets all auth_name fields to hello

Brad Lloyd & Michelle Zukowski 19 Using SQL ALTER TABLE authors ADD birth_date datetime null auth_idauth_nameauth_cityauth_state Jane DoeDearbornMI John SmithTaylorMI To change a table in a database use ALTER TABLE. ADD adds a characteristic. ADD puts a new column in the table called birth_date birth_date.. TypeInitializer

Brad Lloyd & Michelle Zukowski 20 Using SQL ALTER TABLE authors DROP birth_date auth_idauth_nameauth_cityauth_state Jane DoeDearbornMI John SmithTaylorMI To delete a column or row, use the keyword DROP DROP removed the birth_date characteristic from the table auth_state..

Brad Lloyd & Michelle Zukowski 21 Using SQL DROP DATABASE authors auth_idauth_nameauth_cityauth_state Jane DoeDearbornMI John SmithTaylorMI The DROP statement is also used to delete an entire database. DROP removed the database and returned the memory to system

Brad Lloyd & Michelle Zukowski 22 Conclusion SQL is a versatile language that can integrate with numerous 4GL languages and applications SQL simplifies data manipulation by reducing the amount of code required. More reliable than creating a database using files with linked-list implementation

Brad Lloyd & Michelle Zukowski 23 References “The Practical SQL Handbook”, Third Edition, Bowman.