Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev.

Similar presentations


Presentation on theme: "© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev."— Presentation transcript:

1 © 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev

2 © 2002 by Prentice Hall 2 MySQL Ch1 & Ch3

3 © 2002 by Prentice Hall 3 Overview –TcX - Michael Widenius (MySQL) –Hughes - David Hughes (mSQL) –Features: Mostly ANSI SQL2 compliant Transactions Stored procedures Auto_increment fields

4 © 2002 by Prentice Hall 4 More features Cross-database joins Outer joins API: C/C++, Eiffel, Java, PHP, Perl, Python, TCL Runs on Windows, UNIX, and Mac High performance

5 © 2002 by Prentice Hall 5 SQL syntax CREATE TABLE people (name CHAR(10)) INSERT INTO people VALUES (‘Joe’) SELECT name FROM people WHERE name like ‘J%’

6 © 2002 by Prentice Hall 6 SQL commands SHOW DATABASES SHOW TABLES Data types: INT, REAL, CHAR(l), VARCHAR(l), TEXT(l), DATE, TIME ALTER TABLE mytable MODIFY mycolumn TEXT(100) ENUM(‘cat’,’dog’,’rabbit’,’pig’)

7 © 2002 by Prentice Hall 7 SQL commands CREATE DATABASE dbname CREATE TABLE tname (id NOT NULL PRIMARY KEY AUTO_INCREMENT) CREATE INDEX part_of_name ON customer (name(10)) INSERT INTO tname (c1, …, cn) values (v1, …, vn)

8 © 2002 by Prentice Hall 8 JOINs and ALIASing SELECT book.title, author.name FROM author, book WHERE books.author = author.id SELECT very_long_column_name AS col FROM tname WHERE col=‘5’

9 © 2002 by Prentice Hall 9 Loading text files Comma-separated files (*.csv) LOAD DATA LOCAL INFILE "whatever.csv" INTO TABLE tname

10 © 2002 by Prentice Hall 10 Aggregate queries SELECT position FROM people GROUP by position SELECT position, AVG (salary) FROM people GROUP BY position HAVING AVG (salary) > 50000.00

11 © 2002 by Prentice Hall 11 Full text search CREATE TABLE WebCache ( url VARCHAR (255) NOT NULL PRIMARY KEY, ptext TEXT NOT NULL, FULLTEXT (ptext)); INSERT INTO WebCache (url, ptext) VALUES (‘index.html’, ‘Welcome to the University of Michigan’); SELECT url from WebCache WHERE MATCH (ptext) against (‘Michigan’);

12 © 2002 by Prentice Hall 12 Advanced features Transactions Table locking Functions Unions Outer joins

13 © 2002 by Prentice Hall 13 Installing MySQL on Windows http://www.mysql.com/downloads/my sql.html http://www.webdevelopersnotes.com/ tutorials/sql/index.php3


Download ppt "© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev."

Similar presentations


Ads by Google