Download Database

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Database wikipedia , lookup

SQL wikipedia , lookup

Functional Database Model wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Relational model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Project Setting
Group Assignment






PJ1:
PJ2:
PJ3:
PJ4:
PJ5:
PJ6:
Ryan Parkinson
Tomasz Szabla, David Harding, Daniel Maltese
Marc Lafratta, Kiran Varagur, Daniel Moore
Tony Cheung, Leeanna Tieu, Evan Pearce
Vista Eydatoula, Stefan Ionita, Daniel Vacar
Wenfei Tao, Danqing Li, Li Xu
ODBC and FTP setting

ODBC setting for projects 4kd3pj1,…
ODBC NAME
ODBC4KD3PJ1
ODBC4KD3PJ2


LOGIN
4KD3PJ1
4KD3PJ2
PASSWORD
sqlpjone
sqlpjtwo
FTP for 4KD3PJ1, …
ftp://facbusad1.business.mcmaster.ca/4kd3pj1/
Use your own FTP login MAC ID and Password for the
assigned group
URL for 4KD3PJ1,…
http://facbusad1.mcmaster.ca/users/ap1/4kd3pj1/project.html
Project DB Tables

These SQL server accounts have been
recycled from previous years. Please
DELETE any prior existing tables to
avoid any confusion in setting up the
SQL database for your project.
Hint for Assignment 5
Using Dreamweaver to access
assignment 4




Open Dreamweaver
You may need to create the site again if
you do not use the computer you used
before
Open the Tutorial_asp site
Assume you have succeed in
assignment 4.
Add search for product by
occasion




In order to allow user search for
flowers by occasion you need to do
three things:
Add search by occasion option
Let user make choice on occasion
Assemble a SQL query for occasion
search
Add search by occasion option


You can add search criteria in
homepage.html such as
<option
value="ByOccasion">Occasion</option
>
Let user make choice on
occasion



Modify search.asp to create a new case
<% case "ByOccasion"%>
You may copy the code of the case
ByPriceRange and modify it to let the
user select an occasion.
<input type=hidden
name="SearchingMethod"
value="ByOccasion">
Provide occasion options
<select name="UseOccasion" size="1">
<option value="occasioncode1">
Christmas </option> …
</select>
Here the occasioncode1, … should be the
actual code you used in the usage table
as the foreign key for each occasion.
Assemble a SQL query for
occasion search
SQL = "SELECT Products.Product_Code,
Product_Name,Unit_Price FROM Products, Usage
WHERE
((Usage.Product_Code=Products.Product_Code)
and (Occasion_Code=“ &
Request.Form("UseOccasion") & “))"


Since SQL statement in VisualBasic must be on one line. If
you split it into multiple lines, make sure put ”_” for
continuation.
Do not copy and paste the code from PowerPoint directly
because there are hidden codes that causes errors
Enter receiver name and
address



When user places order, you will
request user to enter receiver name
and address
For existing user, you let her enter
receiver name after enter user name
and password in check.asp
For new user, you let her enter receiver
name when she wants to place order in
registration.asp
Enter receiver name and
address
In both check asp and register.asp add
the following:
<tr> <td ALIGN=right><font
face="arial" size=-1>Receiver
Name:</font></td>
<td><input name="ReceiverName"
size="17" maxlength="32"></td>
</tr>
Store additional order
information in database



You need to store receiver name and
address in Order table
In Orderling.asp you may insert
RsOrders("Receiver_Name") =
Request.Form("ReceiverName")
Here Receiver_name should be a field
name in your Orders table
Enhance the looking of your
web page

You can add extra information and
change the style for your web pages.
Extensible Markup Language
(XML)
Problems with original HTML





Cannot separate the content, layout,
and format of pages
Lack of style definitions
Web page elements could not be
accessed from scripts or other programs
No constructs for caching and data
manipulation on the client
Round trip to server
http://www.gtaa.com/webfids/arrival
s.htm
DHTML


Microsoft DHTML: HTML 4.0 + additional features,
Netscape: only HTML 4.0
Key DHTML features:



Document Object Model (DOM)
all page elements as objects that can be manipulated by
scripts
Cascading Style Sheets (CSS)
allow formats to be defined and controlled for the types
of elements, allow overriding
Remote data services (RDS)
allow data to be cached and dynamically displayed
(formatted, sorted, and filtered without round trip to
server)
Extensible Markup Language
(XML)





Much better than HTML and DHTML
Clear separation between document
structure, content, and materialization
using XML and XSL
Standardized but allow for extension
Accurately represent the semantics of the
data
http://www.w3.org/XML/
http://www.w3schools.com/xml/xml_display.asp
XML Documents Form a Tree Structure
Materializing XML Documents
using CSS
<STYLE TYPE =“text/class”>
<!–
customer{font-family:Lucida;fountstyle:normal;color:black}
name {font-family:Lucida;fountstyle:normal;color:green}
lastname {font-family:Lucida;fountstyle:normal;color:red}
-->
</STYLE>
Extensible Style Language
(XSL)


Declarative
create a set of rules that govern how
document is to be materialized
Transformational
XSL can transform an XML into HTML
http://www.xmlpitstop.com/default.asp?D
ataType=XMLEXAMPLES
Example
The Importance of XML to
Database Applications





XML may be most important after
relational model
Standard means for expressing the
structure of database views
Clean separation of structure, content,
and materialization
Document validity checking
Standards for XML document types
The primary uses of XML




Exchanging information between
heterogeneous applications, enterprises,
databases, etc.
Enabling styling and presentation of the same
information on multiple output devices and/or for
different purposes and audiences
As a storage format for long-lived or structurally
rigorous document-centric information, such as
aircraft manuals or enterprise information models.
Source:
http://www.topxml.com/xml/articles/whatisxml/
The XML Family of Standards

Define an XML language




Format and display XML documents




CSS (Cascading Style Sheets)
XSL (Extensible Style Language)
XSLT (XSL Transformations)
Develop processing applications




XML
Namespaces,
XML-Schemas
DOM (Document Object Model)
SAX (Simple API for XML)
XSLT
Exchange information between systems
Purpose-specific standardized XML languages such as:
 SOAP (Simple Object Access Protocol)
 SVG (Scalable Vector Graphics)
 WML (Wireless Markup Language)
 XCBL (XML Common Business Library)
PureEdge XFDL




XFDL provides the ability to securely send and
receive legally-binding XML documents.
Encapsulates presentation, data,
computational logic, and business semantics in
a single XML document.
Can be digitally signed and stored to provide
non-repudiation, enabling high-value, binding
e-commerce transactions.
http://www.pureedge.com (now is IBM Lotus
Electronic forms http://www01.ibm.com/software/lotus/forms/)
Example of XML Standards
Page 299
Figure 11-22
© 2000 Prentice Hall
Outlook of XML



According to Gartner, 75% of the Fortune
500 used XML in at least one pilot project in
2000, and in at least one application
integration project by the end of 2001
According to International Data Corp., the
market for XML servers and databases was
$390 million in 2001 and will be $3.7 billion
by 2005
Source: Language Lessons by Charles
Babcock, CIOINSIGHT, 02.2002
XML Query

XML can represent almost anything—
files, graphics, Web services, etc. As
developers store more and more
information in XML format, they also
have an increasing need to be able to
search and update XML documents.
Why do we need to query XML?




some information that you want to
query does not fit well into a RDBMS
need to be able to query Web data
search, extract, manipulate, and
process XML information
the growth of XML documents used
“outside the browser” for data
exchange
XQuery:
A query language for XML



XQuery is the first language to receive
industry-wide attention and support.
It is currently being developed by the
W3C XML Query Working Group and
has a "Working Draft" status.
It is a vendor independent, powerful,
and easy to understand method for
querying and retrieving XML data.
XQuery:
A query language for XML




The creators of XQuery went beyond basic search and
update capabilities.
An XQuery implementation can search multiple backend systems and combine results, effectively
integrating multiple sources of information.
XQuery can also transform the content and structure
of XML documents. You can use XQuery expressions
such as element and attribute constructors to express
the structure of the result document.
With transformation powers that rival XSLT, XQuery
goes where no query language has gone before
because it not only provides query results, but can
also prepare those results for presentation.
XQuery:
A query language for XML




XQuery is a functional language in which a
query is represented by an expression
XQueries can be nested
The Input and Output of an XQuery is an
instance of the XML Query Data Model (now
called XQuery 1.0 data model)
Based on OQL, SQL, XML-QL, and XPath
SQL vs. FLWR
SQL version:
SELECT pno,
avg(price) AS avgprice
FROM sp
GROUP BY pno
HAVING count(*) >= 3
ORDER BY pno;
XQuery version:
FOR $pn IN distinct(document("sp.xml")//pno)
LET $sp := document("sp.xml")//sp_tuple[pno = $pn]
WHERE count($sp) >= 3
RETURN <well_supplied_item> $pn, <avgprice>
avg($sp/price) </avgprice> </well_supplied_item>
SORTBY(pno)
An application Scenario
In this scenario, the apparel chain Wearhouse
Inc. has a product catalog maintained in XML,
but a sales database maintained in DB2. You are
charged with building some custom reporting
applications. You have just discovered the power
of XQuery, so you decide to use an XML server
capable of data integration to build these
reports. Here's a sample query you might write
that combines information from both the XML
and DB2 data sources:
Source: Tim Matthews and Srinivas Pandrangi Five Practical XQuery Applications
http://www.projectcool.com/xml/Article/15618
XQuery
<sales>
{
for $product in
document("products.xml")/products/product,
$sales in view("db2/sales_view")/sales/product
where $product/productId = $sales/productId
return <product id="{$product/productId}">
{$product/productName, $product/productSpec,
$sales/mrq, $sales/ytd, $sales/margin}
</product>
}
</sales>
XQuery usage examples

Human readable documents
We may want to perform queries on structured
documents or to retrieve individual documents or data
from those documents in order to generate tables of
contents, search for information in the document’s
structures, or to generate new documents as the result
of a query.

Data oriented documents
We may want to perform queries on the XML
representation of database data, object data, or other
data source in order to translate it into new XML data
representations.
Xquery Usage Examples
(cont’d)

Mixed Model Documents
We may want to perform queries on documents
with embedded data such as employee records,
telephone/address listings, etc.

Catalog Search
We may want to query catalogs describing
document servers, document types, XML
schemas, etc to help in identification of the type
of data contained on a server for server
selection.