1 A Very Brief Introduction to Relational Databases.

Slides:



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

Introduction to Structured Query Language (SQL)
CSE 190: Internet E-Commerce Lecture 10: Data Tier.
Concepts of Database Management Sixth Edition
MySQL and PHP By Trevor Adams.
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”
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Introduction to Structured Query Language (SQL)
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Database Lecture # 1 By Ubaid Ullah.
Chapter 9 SQL and RDBMS Part C. SQL Copyright 2005 Radian Publishing Co.
ASP.NET Programming with C# and SQL Server First Edition
 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.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Introduction to SQL Steve Perry
2440: 141 Web Site Administration Database Management Using SQL Professor: Enoch E. Damson.
Chapter 15: Using LINQ to Access Data in C# Programs.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Introduction to databases and SQL. What is a database?  A database is an organized way of holding together pieces of information  A database refers.
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.
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Introduction to SQL.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 UNIT 6: Chapter 7: Introduction to SQL Modern Database Management 9 th Edition Jeffrey A.
1 Structured Query Language (SQL) CIS*2450 Advanced Programming Concepts.
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.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Chapter 5: Part 1: DDL STRUCTURED QUERY LANGUAGE (SQL)
“INTRODUCTION TO DATABASE AND SQL”. Outlines 2  Introduction To Database  Database Concepts  Database Properties  What is Database Management System.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Chapter 10: The Data Tier We discuss back-end data storage for Web applications, relational data, and using the MySQL database server for back-end storage.
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
M1G Introduction to Database Development 5. Doing more with queries.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 7 (Part a): Introduction to SQL Modern Database Management 9 th Edition Jeffrey A.
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.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
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,
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.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
Instructor: Pavlos Pavlikas1 How Data is Stored Chapter 8.
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
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.
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.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
SQL Basics Review Reviewing what we’ve learned so far…….
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.
Introduction to Database Programming with Python Gary Stewart
Fundamentals of DBMS Notes-1.
“Introduction To Database and SQL”
“Introduction To Database and SQL”
STRUCTURED QUERY LANGUAGE
SQL .. An overview lecture3.
The University of Akron College of Applied Science & Technology Dept
INTRODUCTION A Database system is basically a computer based record keeping system. The collection of data, usually referred to as the database, contains.
Presentation transcript:

1 A Very Brief Introduction to Relational Databases

2 Database Management Systems DBMS vs. Files Files hold data. Knowledge of the structure is in the programs that use the files. Example: Addresses.csv Files can hold complex data structures Each program must know how the data is represented in the file. Any change to the representation requires changes to all programs that access the file

3 Database Management Systems A DBMS holds both data and structure Decouples programs from the details of how the data is represented. Permits programs to say what they want in more abstract terms. Simple Example: Give me all the records with zip codes beginning with 336 vs Read each record. Extract the first three digits of the zip code. Skip over the record if not 336. Much more complex operations are possible.

4 Database Management Systems Changes to the structure do not necessarily require changes to the programs that access the data. There is a startup cost Once you have learned the basics, using a DBMS is much easier than writing code to process file data directly.

5 Database Management Systems Have long been the mainstay of large scale data processing. Now readily available for personal computers The.NET Framework provides good support Smooth integration with C# and VB Supported by Visual Studio Used by most real world web sites.

6 Relational Database Specific form of DBMS Invented by E.F. Codd of IBM “ A Relational Model of Data for Large Shared Data Bank” Communications of the ACM; 13(6); 1970 First commercial product produced in 1979 by Relational Software, Inc. Today known as Oracle Corp. Extensive theoretical underpinnings Books, Courses, Career Fields

7 Relational Database Data is organized as tables Rows and columns Basic concept: Every distinct of piece of information is held in only one place. Entries in different tables are related when they have the same value for a field used as a key. Operations permit data from related tables to be combined to answer complex questions. Give me the Product_Description from the Products table entry with Product_ID matching the Product_ID in each Order_Item in the Order_Details table having an Order_ID matching the Order_ID in Current_Invoice.

8 Database Management System The DBMS is a server Often on a dedicated computer. Small version may reside on a PC. Always a separate entity Not a part of the operating system Users and user programs interact with the database server to retrieve and update information in the database.

9 SQL Structured Query Language Industry standard langauge for accessing and manipulating relational databases. Prototype developed by Codd at IBM Now an ANSI and ISO standard Latest version SQL-99 aka SQL-3 Every vendor has its own version Core language fairly consistent Have to learn vendor’s extensions

10 SQL SQL can be used both interactively and by programs. Commands called queries. Run a program for interactive use. The.NET Framework supports access by Windows programs. Programs create query strings to say what they want. Different meaning from query strings in HTML. Same as the strings you might type on a command line for an interactive program. Compiler and runtime system have no understanding of the string.

11 LINQ Visual Studio 2008 and later supports a new feature called LINQ. Language Integrated Query Introduced in.NET Framework 3.5 Permits us to write C# and VB statements to do queries rather than just composing strings and sending them to the server. The compiler can check the syntax (unlike query strings.) Permits queries against data structures as well as databases. Entity Framework Automates production of code to access data Visual Studio 2010 and later

12 Tables All data in a relational database is in Tables To create a table: Specify a name for the table Define columns Specify name for the column Specify data type. Similar but not identical to types in programming languages. Caution: This is just a start. There is a lot more to know about creating a database.

Organization of Data Table should not include multiple columns for the same infomation. Example Table Classes might hold information about various classes being taught in the current semester. One row per class Course number, classroom, times, etc. Not students. Multiple students per class. Variable number of students in class. 13

Organization of Data Students would be in a separate table. One row per student. Another table relates students to classes. One row per student-class pair Identifies class Identifies student Says that this student is in this class 14

15 SQL Sessions Users can interact with a database system, using a program running on their local computer. Command line or GUI Generally must log in with the server User name and password This creates a session. May need to specify a particular database, or one may be determined automatically by user name.

16 SQL Sessions Once logged in, you can Create tables Add entries to tables Modify existing data Retieve information from tables Delete entries from table Delete tables providing you have the relevant privilege Programs can do these same things

17 Database Connections Before a user or a program can interact with a Database system, there must be a connection into the database. An interactive session establishes a connection when logging in. A program must connect to a database by passing a connection string string to the server. Specifies user name and desired database May specify password. Possibly lots of other stuff. Very easy to mess up!

18 Types of SQL Commands DDL Data Definition Language Create and restructure tables DML Data Manipulation Language Change data in tables DQL Data Query Langauage Retrieve information from tables Others Database administration Advanced concepts

19 Data Definition Language CREATE TABLE ALTER TABLE DROP TABLE CREATE INDEX ALTER INDEX DROP INDEX CREATE VIEW DROP VIEW SQL commands are free form Not case sensitive

20 Example: CREATE TABLE CommandTable Name Column NameData Type CREATE TABLE INSTRUCTOR (INSTRUCTOR_ID NUMBER(8,0), SALUTATION VARCHAR2(5), FIRST_NAME VARCHAR2(25), LAST_NAME VARCHAR2(25), STREET_ADDRESS VARCHAR2(50), ZIP VARCHAR2(5), PHONE VARCHAR2(15) )

21 Data Manipulation Language INSERT UPDATE DELETE

Insert a new row into table Book INSERT INTO Book (book_id, title, publisher, publish_date) VALUES (1013, 'Jane Eyre', 'Random House', '12/2013') 22 INSERT Example Table Name Column Names Values for new row Column names may be omitted if a value is provided for every column (in the right order.)

INSERT Example Identity Column Server picks a unique value automatically. Cannot be specified by the user. If book_id is an Identity Column: INSERT INTO Book (title, publisher, publish_date) VALUES ('Jane Eyre', 'Random House', '12/2013') Server chooses a unique value for book_id 23

24 Data Query Language SELECT Only one command Many options and clauses Primary method of interacting with the database Interactive users Programs

SELECT title, publisher FROM book WHERE title = ' Jane Eyre ' Example from a C# program: strSQL = "SELECT * FROM Orders " + " WHERE Store_ID = " + Store_ID.ToString() + " AND Order_ID = " + Order_ID.ToString(); 25 Examples: SELECT Column Names Table Name * means “All Columns” “Where” clause specifies which rows to return These are local variables in the C# program. End of Presentation