Presentation is loading. Please wait.

Presentation is loading. Please wait.

Structured Query Language

Similar presentations


Presentation on theme: "Structured Query Language"— Presentation transcript:

1 Structured Query Language

2 Course Outlook What is Data? What is a Database? Database Tables DBMS
SQL (The real reason you’re here) Zahid Hussin

3 What is Data? It is NOT information!
Information is the result of processing DATA to reveal meaning, whereas DATA is RAW FACTS. Raw Data must be formatted for storage, processing, and presentation. Metadata is another form of Data. Zahid Hussin

4 Data Continued Data is the building block of information.
Information is produced by processing data. Example 1: Each students test score is data, but the average score of the entire class or entire school (its academic progress) is called information. This academic progress determines how much funding the school gets from the government.

5 Metadata? Metadata: data about … data
Provides description of data characteristics and relationships in data Example: First name, Last name, Address, City, Age Zahid Hussin

6 I know what data is, how do I store it?
The Database! It is a shared, integrated, STRUCTURED, and Organized computer mechanism which stores a collection of data. It is used for managing and retrieving information which is done through the use of TABLES. Zahid Hussin

7 Database Tables Consist of Columns and Rows.
Each row corresponds to a single record or entry. Fields (Columns) can also have a primary key. A primary key is a column which is labeled as the INDENTIFIER. It cannot have any duplicate data.

8 DBMS The interface which manages the interaction between the End-User and the Database. Enables data to be shared

9 Most popular DBMS Oracle MySQL Microsoft SQL Server The rest…
Zahid Hussin

10 Installing and setting up a DBMS
Zahid Hussin

11 SQL … Finally! Structured Query Language
Defines methods to manipulate database Manipulating could mean getting information from and updating a database. An attempt to REQUEST some data from a database is called a QUERY. Each formed SQL statement refers to an SQL QUERY. Resembles natural language Is the standard for the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO). Zahid Hussin

12 CRUD…what is this? You will be asked to perform CRUD SQL functions.
It is an acronym for the basic database operations; Create, Read, Update, and Delete. These can be SQL statements such as Insert, Select, Update, and Delete Any simple database table enforces CRUD constraints. If you are ever asked to perform CRUD SQL statements, now you know. Zahid Hussin

13 CRUD EXAMPLE A Simple student database table;
Adds (Creates) new student details Accesses (reads) existing student details Modifies (updates) existing student data as subjects Deletes student details when students leave the school The corresponding SQL operations are; Add (INSERT) new records Retrieve/Access (SELECT) existing records based on selection conditions Modify (UPDATE) existing records Remove (DELETE) tables or entire records Zahid Hussin

14 CREATE What is; Integer varchar2( ) varchar( ) others General Query:
CREATE TABLE table_name (first_column_name type_of_data, Second_column_name type_of_data) Example: CREATE TABLE PERSONS (ID Integer primary key, FIRSTNAME varchar2(20), LASTNAME varchar2(20), CITY varchar2(20), AGE number) What is; Integer varchar2( ) varchar( ) others Zahid Hussin

15 INSERT Data MUST be input into VALUES in row order.
General Query: INSERT INTO table_name VALUES (value1, value2, …) Example: INSERT INTO PERSONS VALUES (1, ‘Bat’, ‘Man’, ‘Gotham’, 54) Remember ID, FIRSTNAME, LASTNAME, CITY, AGE Data MUST be input into VALUES in row order. Do some more examples.

16 SELECT General Query: SELECT column_name FROM table_name SELECT *
Example: SELECT LASTNAME, FIRSTNAME FROM PERSONS


Download ppt "Structured Query Language"

Similar presentations


Ads by Google