1 / 11

Web Development

Web Development. SQL. What is it?. SQL stands for Structured Query Language It is a text based scripting language for setting up and manipulating databases There are different flavours of SQL depending upon the manufacturer and software used

damon
Download Presentation

Web Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Development SQL

  2. What is it? • SQL stands for Structured Query Language • It is a text based scripting language for setting up and manipulating databases • There are different flavours of SQL depending upon the manufacturer and software used • E.g. Microsoft SQL has a few differences to other versions • We will be using an open source database: MySQL (pronounced My Sequel)

  3. How it fits in with PHP • Remember that EasyPHP comes as three programs, together known as AMP: • Apache • MySQL • PHP • That’s why MySQL can be used on its own; it is a program in its own right • PHP goes together nicely with MySQL because web apps often need a back end database

  4. Ways to use it • SQL can be used on its own in phpMyAdminor embedded within php code • In phpMyAdmin, the commands can be typed in one at a time or processed in a batch file • To open phpMyAdmin, right click on the php server icon, then select Configuration and phpMyAdmin • SQL commands are written in uppercase. E.g. CREATE (this makes it stand out in the php code)

  5. SQL Commands • CREATE: • Used to create whole databases or tables: • E.g. CREATE DATABASE mydatabase; • CREAT TABLE people; • Note: SQL lines end with a semi colon ;

  6. SQL Commands • INSERT INTO: • Used to add data into tables: • E.g. INSERT INTO people VALUES (1, “fred”);

  7. SQL Commands • SELECT: • Used to query the database • This is the one you really need to know for the assignment! • E.g. SELECT name FROM people; • SELECT * FROM people;

  8. SQL Commands • WHERE: • Used to add criteria to a query • Another one you really need to know for the assignment! • E.g. SELECT name FROM people WHERE age=21;

  9. SQL Commands • LIKE: • Used to add wildcards to a query • E.g. SELECT name FROM people WHERE age LIKE ‘2%’; • This query would return a match for all people with an age that started with 2

  10. SQL Commands • ORDER BY: • Used to sort query results into order • E.g. SELECT name FROM people WHERE age=21 ORDER BY name;

  11. SQL Commands • AND / OR: • Used to make logical choices when querying • E.g. SELECT name FROM people WHERE age>17 AND age<66 ORDER BY name;

More Related