Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 2720 Building Web Applications Database and SQL.

Similar presentations


Presentation on theme: "CSC 2720 Building Web Applications Database and SQL."— Presentation transcript:

1 CSC 2720 Building Web Applications Database and SQL

2 Database and DBMS  Database – Structured collection of records or data  Database Management System (DBMS) – Specialized software for managing databases  Relational Database – A type of database in which data are organized as related tables  Most widely used type of databases

3 Advantages of using DBMS  Efficient Data Access  Support multiple users and Data Security  Protect access to data in which only authorized users can access the data  Concurrent Access  Support mechanisms to allow multiple users to safely read/write the data. (e.g., record locking)  Transaction  Crash Recovery

4 Advantages of using DBMS  Standardized query language for defining and manipulating data  Network accessible DBMS Web App (Java Servlet) Web App (PHP) Web App (ASP.NET) Stand alone App (Java / C++ / C ) Database Management Tools SQL

5 Introduction to Relational Database  Data are stored in tables (a.k.a. relations). ItemIDNamePriceQuantity 0123456Coffee4.50100 0222222Soy Milk4.4050 0142562Tea5.0040 Row / Record Column / Field / Attribute  A table has a name.  A field has a name and a type.  Besides some standard types, different DBMS (e.g., Oracle and MySQL) may also have their own specific types.

6 Characteristics of a Table  A field is said to contain a null value when it contains nothing at all.  When defining a table, we can set whether a field can contain a null value or not.  Keys are special fields that serve a specific purpose within a table.  A Primary key is a field (or combination of fields) that uniquely identifies a record within a table.  A Foreign key is the field that is used to establish a relationship between a pair of tables.A foreign key has to be a primary key of another table.  Row orders are not important.

7 Structured Query Language (SQL)  A standardized language that can be used to build, modify, maintain and manipulate a database  SQL supported by different DBMS may vary slightly.  With SQL, you can  Create/delete a database  Create/delete tables in a database  Retrieve data from a database  Insert new records in a database  Delete records from a database  Update records in a database

8 SQL (con't)  SQL is case insensitive  Multiple statements are separated by semicolon  Important commands for manipulating data  SELECT - extracts data from a database table  UPDATE - updates data in a database table  DELETE - deletes data from a database table  INSERT INTO - inserts new data into a database table  Important commands for manipulating table  CREATE TABLE - creates a new database table  ALTER TABLE - alters (changes) a database table  DROP TABLE - deletes a database table  Examples: SQL Tutorial at W3Schools  http://www.w3schools.com/sql/default.asp http://www.w3schools.com/sql/default.asp


Download ppt "CSC 2720 Building Web Applications Database and SQL."

Similar presentations


Ads by Google