Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
View
DBMS History
The IBMs System/R was not the first DBMS. The first to market was Relational Software's product named Oracle The second was Relational Technology's Ingres.
IBM then released improved products in 1982 named SQL/DS and DB2. Oracle and DB2 in nth generation forms while the Ingres technology was bought by Computer Associates.
SQL - Standards
The ANSI-SQL (American National Standards Institute) group has published three standards over the years:
SQL89 (SQL1) SQL92 (SQL2) SQL99 (SQL3)
The majority of the language has not changed through these updates. The SQL standard from ANSI is considered the "pure" SQL and called ANSI-SQL.
Every DBMS vendor wants their products to be different. So most products offers extra features, these additions are generally not compatible with competitor's SQL products. It is always safest to stick with pure SQL
The enhancements are not all bad because these extensions are very useful.
For example, most DBMS sold today have an automatic way to assign a serial number feature since serial numbering is so common. However, the method of implementation is not uniform.
What is a View?
When we say Relation, it could be a Table or a View. There are three kind of relations:
1.
Stored relations tables We sometimes use the term base relation or base table 2. Virtual relations views 3. Temporary results
Example: Create a view with title and year and made by Paramount studio.
Movie (title, year, length, inColor, studioName, producerC#) CREATE VIEW ParamountMovie AS SELECT title,year FROM Movie WHERE studioName = Paramount;
A view could be used from inside a query, a stored procedure, or from inside another view. By adding functions, joins, etc., to a view, it allows us to present exactly the data we want to the user.
View SELECT title FROM ParamountMovie WHERE year = 1979; Have same result as Table SELECT title FROM Movie WHERE studioName = Paramount AND year = 1979;
Query involving both view and table SELECT DISTINCT starName View FROM ParamountMovie, StarsIn Table WHERE title = movieTitle AND year = movieYear;
CREATE VIEW MovieProd AS SELECT title, name FROM Movie, MovieExec WHERE producerC# = cert#; SELECT name FROM MovieProd WHERE title = Gone With the Wind;
Same result as query from tables SELECT name FROM Movie, MovieExec WHERE producerC# = cert# AND title = The War Of the World;
CREATE VIEW MovieProd (movieTitle, prodName) AS SELECT title, name FROM Movie, MovieExec WHERE producerC# = cert#;
selecting (SELECT not SELECT DISTINCT) some attributes from one relation R (which may itself be an updateable view)
The WHERE clause must not involve R in a subquery. The list in the SELECT clause must include enough attributes that will allow us to insert tuples into the view as well as table. All other attributes will be filled out with NULL or the proper default values.
Then
INSERT INTO ParamountMovie VALUES (Paramount, Star Trek, 1979); Title year length Star Trek 1979 0 inColor NULL studioName Paramount producerC# NULL
Suppose we wish to delete all movies with Trek in their title from the updateable view ParamountMovie.
DELETE FROM ParamountMovie WHERE title LIKE %Trek%;
DROP view: All views can be dropped, whether or not the view is updateable.
DROP VIEW ParamountMovie;
DROP VIEW does not affect any tuples of the underlying relation (table) Movie. However, DROP TABLE will delete the table and also make the view ParamountMovie unusable.
DROP TABLE Movie
MySQL (Windows User / version 4.1.10a, 5.0.2alpha has bug that keep shutting down the service) MySQL Administrator MySQL Query Browser
you can <Skip Sing-Up> to fast installation Will run Configuration Wizard right after installation automatically If the service wont start, press <cancel>, then run Configuration Wizard manually again
use default setting unless you know what you are doing Modify Security Setting (option: you can start service without doing this) Execute
If there is an error, try press <back> to go back, then press <next> to <execute> again
Try different port number if you are using networking.
TCP / IP Networking
MySQL Administrator come with MySQL System Tray Monitor allow you to configure your server Run MySQL Administrator For the first time, you may not have Stored connection, you can <Add new Connection> and give the Connection name. Server Host: type localhost If you dont use networking
Run MySQL Query Browser Give a name for the Default Schema
You can type command line into the top box or right Click on schemata to create new table
SQL - Bibliography
First Course In Database Systems, Jeffery D. Ullman and Jennifer Widom,1997 Prentice Hall, Inc. http://mysql.com