s Advance Database Systems Week-2 Dr.Kwanchai Eurviriyanukul
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 processing 3.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 DB Update 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
Select Data use advancedb54; select * from villagebigtable;
Closer Look
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 เชียงใหม่ - จอมทอง - แม่สอย - หมู่ 13 => ห้วย พัฒนา เชียงใหม่ - แม่แจ่ม - ช่างเคิ้ง - หมู่ 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?
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;
We need to automatic create id for region name ALTER TABLE `advanceDB54`.`region` CHANGE COLUMN `region_id` `region_id` INT(11) NOT NULL AUTO_INCREMENT
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+mo o
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 Outlines WeekTopicDateLabBrief Content 1Reviews of Database Management Systems3/11/2554Basic PHP Programming-file processingSQL and Query Evaluation 2XML10/11/2554Basic PHP Programming-functionIntroduction to XML technology XML XML How to use XML Tree XML Syntax XML Elements XML Attributes 3DTD17/11/2554DTD Construction and ValidationDTD Structure Elements Attributes Elements vs Attr alidation Examples 4XML Schema/ XML namespace24/11/2553XML Schema Consturction and Validation-Simple TypeHow to declare the XML schema. How to refer XML schema in your XML document. How to construct the XML schema How to construct the simpleType elements for XML schema How to use restriction on simpleType 5XML Schema1/12/2554XML Schema Consturction and Validation-Complex TypeComplex Types Elements Mixed Indicators Data Types 6Xpath8/12/2554PHP Implementation for XpathIntro Nodes Syntax 7Xpath-Advance15/12/2554PHP Implementation for Xpath-1Syntax cont. Axes Operators Examples 8Xquery22/12/2554XQuery Evaluation with Eclipse-1Intro Example FLWOR expression XQuery Syntax 9Mid-Term29/12/ Xquery-cont.5/01/2555XQuery Evaluation with Eclipse-2XQuery Add XQuery Select XQuery Functions 11XSLT12/01/2555XSLT programming with Eclipse and PHP-1XML Transformation XSLT Basic information XSLT Syntax and Running Example a. Template b. Value-of c. For-each 12XSLT-cont.19/01/2555XSLT programming with Eclipse and PHP-2Sort IF CHOOSE APPLY TEMPLATE XSL Element and XSL Attribute Processing XSL at server side Setting Webserver and PHP to support XSLT 13Web Services26/01/2555Remote Web Services InvocationWebservices Basic concept Webservices component WSDL Web Services cont.2/02/2555Implementation of Web Service PlatformsWSDL 2.0, SOAP, UDDI 15AJAX9/02/2555AJAX, Web Service, XML and Database Management SystemsCreate Object XHR Request XHR Response readyState AJAX ASP/PHP AJAX Database AJAX XML File 16Distributed Query Processing16/02/2555PHP and FQL implementationFacebook Query Language (FQL) Syntax, Function and Tables 17Final23/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?
Why do we need normalization?
Village-ER => Normalization?
Now we need to populate the data
Week-1-Lab From Spreadsheets to the Web 1.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 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 Web 1.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_name from village;
Write Your program
Output
Fix it mysql-thai.html mysql-thai.html
Modify your code
Thai