1302325 s1 2011 Advance Database Systems Week-2 Dr.Kwanchai Eurviriyanukul [email protected].
-
Upload
scott-todd -
Category
Documents
-
view
221 -
download
1
Transcript of 1302325 s1 2011 Advance Database Systems Week-2 Dr.Kwanchai Eurviriyanukul [email protected].
Week-1-Homework
• Marking criteria.1. You have successfully created your database. (2.5
marks)2. You have successfully populated your data into
your big table. (2.5 marks)3. You have successfully populated your data into
your normalized tables (2.5 marks)4. Your have demonstrated the enforcement of
foreign key constraints for your database. (2.5 marks)
Homework-Week-2
1. Data Population (Normalization from last week)
2. HTML processing3. Venn Diagram Creation
Homework-Week-2
1. Data Population (Normalization from last week)
Homework-Week-2
1. HTML processing
Your DOM.php
HTML processing (Your DOM.php)
Homework-Week-2
1. Venn Diagram Creation
Homework-Week-2
1. Venn Diagram Creation
End of the homework
Goal
• Data Integration Systems for …
Contents
• Constraints• Concurrency Controls• XML Basics• Venn Diagram• Google Maps
Normalization
Create Table and Constraints
• CREATE TABLE `village` ( `vill_id` int(11) NOT NULL, `vill_moo` varchar(10) DEFAULT NULL, `vill_name` varchar(100) DEFAULT NULL, `tambon_tam_id` char(10) NOT NULL, PRIMARY KEY (`vill_id`), foreign key (tambon_tam_id) references tambon(tam_id)) ENGINE=innodb DEFAULT CHARSET=utf8;
Sync Workbench with DBUpdate model
Now We got an updated Model
• Don’t forget to drag a new table into a new model
We need to populate data into new tables
We need to populate data into new tables
Select Datause advancedb54;select * from villagebigtable;
Closer Look
How many records we have in villageBigTable?
How many records we have in villageBigTable?
We need to populate data into new tables
• From where to where?
We need to populate data into new tables
• From where to where?
Let’s analyse village ID
How many digits is used for provinceID
• province-district_name-sub_district_name-moo
• 50-02-09-13• เชี�ยงใหม่-จอม่ทอง-แม่สอย-หม่�13 => ห�วยพั�ฒนา• 50-03-01-02• เชี�ยงใหม่-แม่แจม่-ชีางเคิ้��ง-หม่�2 =>ต่อเรื�อ
We need to populate data into new tables
• From where to where? Let’s start with region table;
How to populate a region table?
How to populate a region table?
• We need to get the unique name of the region_name from villageBigTable; => How?
How to populate a region table?
• We need to get the unique name of the region_name from villageBigTable; => How?
• select distinct region_name from villagebigtable;
select distinct region_name from villagebigtable;
select distinct region_name from villagebigtable;
Concurrency control Google doc
How many digits is used for provinceID
• Village_ID =>Province+district_name+sub_district_name+moo
Course Details• Course Description• Relational database theory, object-oriented database system, distributed
database system, active database, distributed object-oriented database system, data warehouse, data mining, digital library, dynamic database system, and reasoning management database system.
• Course Objectives • After completing the course students should be able to• 1. Understand the concepts for Advance Database System and XML.• 2. Know and select tools for Advance Database Systems and XML.• 3. Able to develop programs by using the knowledge from 1. And 2.
Course OutlinesWeek Topic Date Lab Brief Content1 Reviews of Database Management Systems 3/11/2554 Basic PHP Programming-file processing SQL and Query Evaluation
2 XML 10/11/2554 Basic PHP Programming-function Introduction to XML technology XML XML How to useXML TreeXML SyntaxXML ElementsXML Attributes
3 DTD 17/11/2554 DTD Construction and Validation DTD StructureElementsAttributesElements vs AttralidationExamples
4 XML Schema/ XML namespace 24/11/2553 XML Schema Consturction and Validation-Simple Type How to declare the XML schema.How to refer XML schema in your XML document.How to construct the XML schemaHow to construct the simpleType elements for XML schemaHow to use restriction on simpleType
5 XML Schema 1/12/2554 XML Schema Consturction and Validation-Complex Type Complex TypesElementsMixedIndicators<any><anyAttribute>Data Types
6 Xpath 8/12/2554 PHP Implementation for Xpath IntroNodesSyntax
7 Xpath-Advance 15/12/2554 PHP Implementation for Xpath-1 Syntax cont.AxesOperatorsExamples
8 Xquery 22/12/2554 XQuery Evaluation with Eclipse-1 IntroExampleFLWOR expressionXQuery Syntax
9 Mid-Term 29/12/2554 10 Xquery-cont. 5/01/2555 XQuery Evaluation with Eclipse-2 XQuery Add
XQuery SelectXQuery Functions
11 XSLT 12/01/2555 XSLT programming with Eclipse and PHP-1 XML TransformationXSLT Basic informationXSLT Syntax and Running Examplea. Templateb. Value-ofc. For-each
12 XSLT-cont. 19/01/2555 XSLT programming with Eclipse and PHP-2 SortIFCHOOSEAPPLY TEMPLATEXSL Element and XSL AttributeProcessing XSL at server sideSetting Webserver and PHP to support XSLT
13 Web Services 26/01/2555 Remote Web Services Invocation WebservicesBasic conceptWebservices componentWSDL 1.1
14 Web Services cont. 2/02/2555 Implementation of Web Service Platforms WSDL 2.0, SOAP, UDDI
15 AJAX 9/02/2555 AJAX, Web Service, XML and Database Management Systems Create ObjectXHR RequestXHR Response readyStateAJAX ASP/PHPAJAX DatabaseAJAX XML File
16 Distributed Query Processing 16/02/2555 PHP and FQL implementation Facebook Query Language (FQL) Syntax, Function and Tables
17 Final 23/02/2555
Week-1
• Lecture• Reviews of Database Management Systems– SQL and Query Evaluation
• Lab– From Spreadsheets to the Web
Week-1:Lecture
• Reviews of Database Management Systems– SQL and Query Evaluation
• Introduction• Data Modeling• SQL
Exercise
• Let’s create an E-R for the following data (using a SQL statement)
39
Create a table
Show create table village
Village-ER
Village-ER => Normalization?
Village-ER => Normalization?
Why do we need normalization?
Village-ER => Normalization?
Now we need to populate the data
Week-1-Lab
• From Spreadsheets to the Web1. Spreadsheets (MSExcel) to Relational DB
(MySQL)2. MySQL to Web (PHP)3. Web (PHP) to WebService (Google Map)
Pre-requisite
• You need to have the following applications on your machine– Your local Web server (appserv)– Your IDE (Eclipse)– Mysql workbench
• Internet
Your local Web server (appserv)
• If you use appserv 2.6.x you might have a problem about calling phpMyAdmin
• You need to make a call to 127.0.0.1 instead• And you need to change the config file and
reboot
From Spreadsheets to the Web
1. Spreadsheets (MSExcel) to Relational DB (MySQL)
1. Let’s see Thai version created by my advisees.
Villages in ChiangMai
In CVS
Use MySQL workbench to create your database
Create Your Database
Some time you need to synchronize your model with your localhost
Output at localhost
Let’s import data from excel
Error Why?
Wrong Selection => Select your table
Now Select a file to import
Error Again
Choose the right option
Don’t forget to set your encoding
Choose the right option
Week-1-Lab
• From Spreadsheets to the Web1. Spreadsheets (MSExcel) to Relational DB
(MySQL)2. MySQL to Web (PHP)3. Web (PHP) to WebService (Google Map)
PHP Code
Output
Your turn: I want sub_district_name
1. No duplicate
Your turn: I want sub_district_name
1. No duplicate
select distinct sub_district_namefrom village;
Write Your program
Output
Fix it
• http://www.thaicreate.com/community/php-mysql-thai.html
Modify your code
Thai