Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "SQL Queries Relational database and SQL MySQL LAMP SQL queries A MySQL Tutorial and applications Database Building."— 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)Apache MySQL (database system) Perl/PHP (programming language)PHP 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 (Safari Tech Books Online ) Establishing and terminating connection Our database: samp_db

9 Applications Examples of MySQL UCSC Human Genome Project Working DraftUCSC Human Genome Project Working Draft LOCal: A Flexible Web-Based Microscope Reservation System – Univ. of Wisconsin, MadisonLOCal: A Flexible Web-Based Microscope Reservation System You are going to find out more fine examples ….

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

11 Database Building Basics(cont.) Create a table in MySQL: Method 1 – create it in MySQL – easy to make mistakes Method 2 – create/update in your favorite editor (linux or widow) first and then run mysql in Batch mode. Example: Edit mysql command to create a table “student” and save it as a file, “create_student.sql”. At linux prompt type the follow will create a table student in database webdb. mysql webdb < 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 table 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 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 A MySQL Tutorial and applications Database Building."

Similar presentations


Ads by Google