RELATIONAL DATABASES AND XML

Slides:



Advertisements
Similar presentations
Michael Pizzo Software Architect Data Programmability Microsoft Corporation.
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
CSE 190: Internet E-Commerce Lecture 10: Data Tier.
SQL Tutorials To understand some of the topics please analyze the following tutorials: The following tutorials will help:
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.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
Relational DBs and SQL Designing Your Web Database (Ch. 8) → Creating and Working with a MySQL Database (Ch. 9, 10) 1.
SQL in Action Amit Bhawnani & Nimesh Shah. Basic Structure SQL is based on set and relational operations with certain modifications and enhancements A.
Component 4/Unit 6f Topic VI: Create simple querying statements for the database The SELECT statement Clauses Functions Joins Subqueries Data manipulation.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
MIS 301 Information Systems in Organizations Dave Salisbury ( )
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Organizing Data Revision: pages 8-10, 31 Chapter 3.
Using Special Operators (LIKE and IN)
Chapter 14 - Designing Data Access Classes1 Chapter 14 Designing Data Access Classes.
Databases MIS 21. Some database terminology  Database: integrated collection of data  Database Management System (DBMS): environment that provides mechanisms.
CS 1308 Computer Literacy and the Internet
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Subqueries Steve Perry 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,
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
SQL Overview Structured Query Language. Description  When Codd first described the theory of relational databases, he asserted that there should be a.
© Keith Vander Linden, A language that doesn't affect the way you think about programming is not worth knowing. - Alan Perlis, “Epigrams in Computing”,
Understanding Databases Lesson 6. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Relational Database Concepts Understand relational.
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
Chapter 13.3: Databases Invitation to Computer Science, Java Version, Second Edition.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 6 This material was developed by Oregon Health & Science.
WEEK# 12 Haifa Abulaiha November 02,
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
P ROGRAMMING L OGIC AND D ESIGN S IXTH E DITION Chapter 14 Using Relational Databases.
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.
Data Resource Management Application Layer TPS A RCHITECTURE Data Layer Sales/MarketingHR Finance/Accounting Operations Spreadsheet Data MS Access Accounts.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
COM621: Advanced Interactive Web Development Lecture 11 MySQL – Data Manipulation Language.
2b. Create an Access Database Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.
Standard language for querying and manipulating data Structured Query Language Many standards out there: ANSI SQL, SQL92 (a.k.a. SQL2), SQL99 (a.k.a. SQL3),
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
Databases Stefano Grazioli.
Database, SQL and ADO.NET
How to: SQL By: Sam Loch.
Tables & Relationships
Chapter 1 Introduction.
Chapter 5 Introduction to SQL.
Order Database – ER Diagram
Relational Model.
SQL Relational Database Project
INLS 623– Database Systems II– File Structures, Indexing, and Hashing
© 2016, Mike Murach & Associates, Inc.
 2012 Pearson Education, Inc. All rights reserved.
The Database Exercises Fall, 2009.
Chapter 12 Information Systems.
Introduction to Database Systems
Order Database – ER Diagram
What is a Database and Why Use One?
Structured Query Language (SQL) William Klingelsmith
Insert, Update, Delete Manipulating Data.
MIS2502: Review for Exam 1 JaeHwuen Jung
5.02 Understand database queries, forms, and reports used in business.
MIS2502: Data Analytics Converting ERDs to Schemas
PHP and MySQL.
Introduction To Structured Query Language (SQL)
Introduction To Structured Query Language (SQL)
Projecting output in MySql
The University of Akron College of Applied Science & Technology Dept
MIS2502: Data Analytics Relational Data Modeling 3
Manipulating Data Lesson 3.
Presentation transcript:

RELATIONAL DATABASES AND XML 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 1

Objectives Compare the following data storage technologies: Describe a relational database. Describe XML. Write a program that accesses data from a relational database. Design relational database tables. Use Structured Query Language (SQL) Access a database from Visual Basic .NET Access a database using Java Database Connectivity (JDBC) Write a program that accesses data from an XML file. Create an XML document. Identify the .NET XML classes 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 2

Tables and Relationships 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 3

One-To-One Relationships Almost always expressed as an attribute of a table. Customer 1 FirstName 1 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 4

One-To-Many Relationships A table has 0, 1, or many related records Usually expressed through a foreign key relationship Primary key is on the “one” side of the relationship. Order1 FK Order2 Customer FK PK Customer3 FK 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 5

Many-to-Many Relationships 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 6

Data Access Classes for Bound Controls SqlConnection Defines connection SqlDataAdapter Retrieves data from the database DataSet Stores the data DataGrid Bound control 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 7

Data Bound Controls 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 8

Updating Data 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 9

Deleting Records 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 10

Validating Data 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 11

SELECT results SELECT FirstName, LastName FROM tblCustomer 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 12

SELECT with Where Clause SELECT FirstName, LastName, City, State FROM tblCustomer WHERE State = 'CO' OR State = 'CA' 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 13

SELECT with BETWEEN SELECT * FROM tblOrder WHERE OrderDate BETWEEN '1/4/2001' an '6/5/2001' 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 14

SELECT With LIKE SELECT * FROM tblCustomer WHERE FirstName LIKE 'J%' Wildcard characters * ? % _ [a-m]% 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 15

SELECT With IN SELECT FirstName, LastName, State FROM tblCustomer WHERE State IN ('CO','WI') 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 16

ORDER BY SELECT * FROM tblOrder ORDER BY OrderDate Desc SELECT TOP 3 * 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 17

JOINS SELECT FirstName, LastName, OrderDate FROM tblOrder INNER JOIN tblCustomer ON tblOrder.CustomerID = tblCustomer.ID 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 18

Data Returned by Join 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 19

Aggregates SELECT tblOrder.CustomerID, FirstName, LastName, COUNT(dbo.tblOrder.CustomerID) AS TotalOrders FROM tblOrder INNER JOIN tblCustomer ON tblOrder.CustomerID = tblCustomer.ID GROUP BY FirstName, LastName, CustomerID 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 20

Results of Previous Query 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 21

HAVING SELECT tblOrder.CustomerID, FirstName, LastName, COUNT(dbo.tblOrder.CustomerID) AS TotalOrders FROM tblOrder INNER JOIN tblCustomer ON tblOrder.CustomerID = tblCustomer.ID GROUP BY FirstName, LastName, CustomerID HAVING (COUNT(tblOrder.CustomerID) > 1 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 22

Aggregate Functions 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 23

UPDATE UPDATE tblItem SET Price = Price * 1.1 UPATE tblInventory WHERE RetailPrice > 100 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 24

DELETE DELETE * FROM tblOrder WHERE OrderDate < '10/31/98' 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 25

INSERT INSERT INTO tblOrder (CustomerID, OrderDate) VALUES (119, '6/16/2001') INSERT INTO tblOrderArchive SELECT * FROM tblOrder WHERE OrderDate < #6/1/2001# 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 26

XML Element with Subelements <Person firstName="John" lastName="Doe" address1="123 Main Street" address2 = "' '" city="Sometown" state="OH"   zip="22222" phone="111-242-5512">             <orders>                         <order id="111"                                     itemid="2923"                                     itemdesc="Super Foo Widget">                         </order>             </orders> </Person> 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 27

XML/XSL Hierarchy 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 28

XML and XSL Example 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 29

XML Classes in VB.NET xmlNode xmlNodeList xmlDocument 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 30

Summary In this unit the students learned to: Compare the following data storage technologies: Describe a relational database. Describe XML. Write a program that accesses data from a relational database. Design relational database tables. Use Structured Query Language (SQL) Access a database from Visual Basic .NET Access a database using Java Database Connectivity (JDBC) Write a program that accesses data from an XML file. Create an XML document. Identify the .NET XML classes 12/3/2018© 2006 ITT Educational Services Inc. Structured Programming: Unit 9 Slide 31