Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Queries Relational database and SQL MySQL LAMP SQL queries

Similar presentations


Presentation on theme: "SQL Queries Relational database and SQL MySQL LAMP SQL queries"— Presentation transcript:

1 SQL Queries Relational database and SQL MySQL LAMP SQL queries
A MySQL Tutorial and applications Database Building

2 Relational Database and SQL
A particular kind of DBMS that is very good at relating information stored in one table to another –> to pull data from those tables and to join info from related tables to produce answers to the questions that can’t be answered from individual tables alone. SQL (Structured Query Language) standard database language.

3 MySQL Relational database system
Client/server architecture (101 simultaneous connections) SQL (table size for Linux = 4GB) Programming languages: C, C++, Java, Perl, PHP, Python, and Tcl ODBC (Microsoft) Platform independence, security, and speed

4 LAMP Linux (operating system) Apache (web server system)
MySQL (database system) Perl/PHP (programming language) LAMP is an open source dream team LAMP is supported here by: athena

5 PHP Pure HTML  static web site
PHP  enable you to build dynamic web site A server-side scripting language designed specifically for the web Conceived in 1994 by Rasmus Lerdorf as one-man project then adapted by many PHP (Hypertext Preprocessor)

6 SQL Queries When you use MySQL, you are using 2 programs(client/server): Database server is a program located on the machine where your data are stored. It listens for client requests coming from network Clients are programs that connect to the database server and issue queries to tell it what info they want

7 Benefits of Client/Server
The server provides concurrency control so that two users cannot modify the same record at the same time You don’t have to be logged in on the machine where your database is located

8 A MySQL Tutorial An excellent MySQL Tutorial: MySQL by DuBois (Lib. reserve room) Establishing and terminating connection Our database: webdb136

9 Two Applications Examples of MySQL
UCSC Human Genome Project Working Draft LOCal: A Flexible Web-Based Microscope Reservation System – Univ. of Wisconsin, Madison

10 Database Building Basics
Create a option file named .my.cnf in your home directory with content – this will save your time to login every time: [client] User = your-mysql-username Password = your-password After creating the above file, chmod 600 .my.cnf Familiar yourself with MySQL by using a tutorial and you are ready to go Create a database in MySQL

11 Database Building Basics(cont.)
Create a table in MySQL: Method 1 – create in MySQL Method 2 – Define first and then create/update in athena/gaia In the directory of “create_student.sql”, at athena prompt to create a table “student” in our database “webdb 136”: mysql webdb136 < create_student.sql

12 Database Design Issues
Understanding the process and relations Objectstables, attributes  columns, data types, relations index, primary keys Our database: 1 tables student

13 The First Normal Form Columns with similar content must be eliminated
A table must be created for each group of associated data Each data must be identifiable by means of a primary key (unique index)

14 Second Normal Form Whenever the contents of columns repeat themselves, this means that the table must be divided into several sub-tables These table must be linked by foreign keys (cross reference)

15 A good example of normalizing a database
Third Normal Form Columns that are not directly related to the primary key must be eliminated A good example of normalizing a database


Download ppt "SQL Queries Relational database and SQL MySQL LAMP SQL queries"

Similar presentations


Ads by Google