DATABASE - MYSQLSoonja Yeom
MVC<code/>HTML5 / CSS/ BootstrapJavaScript, jQuery, AJAXINTERNETWorld Wide Web (WWW)Protocol, HTTP MessageWeb SecurityPHPDatabaseMySQLFrameworkMVC, LaravelDOM
SQL FOR DATA RETRIEVAL•SQL allows a user or an application program toretrieve stored data from the database and tomanipulate it•SQL operates on one or more tables at a time,not on one record at a time•No loops
RELATIONALALGEBRA
RELATIONAL ALGEBRA (RA) OPERATIONS•Operations in the Relational Model•Theory behind operations is formally defined (in mathematics)•Relational operators operate on operands (either a simple relation or a pair of relations)to produce a result that is a relation•The result relation can be used as an operand in later operations
RA OPERATORS –CARTESIAN PRODUCT AND JOIN•Cartesian product joins each row of thefirst table to every row of the secondtable•There are several types of joins•EQUIJOIN•INNERJOIN•OUTERJOIN•etcXèCartesian ProductJoin*
RA OPERATORS – SELECT AND PROJECT•Selecting row(s) from a table•Selecting column(s) from a tableSelectProject
PROJECTIONS•Aprojectionis a subset of the columns in a table used when only somecolumns are required or being updatedSELECT `firstname`, `lastname`FROM `customer`
SQL FOR RETRIEVING : PROJECTIONS•Retrieve data•projections (selected columns)•display all columns and rows•display specified columnsSELECT * FROMtable_name;SELECTcolumn_name1,column_name2,… FROMtable_name;
SELECTIONS•Aselectionis a subset of the rows in a table•typically, those rows that match some selection criteriaSELECT * FROM `customer` WHERE`custID` = 995501
SQL FOR RETRIEVING : SELECTIONS•retrieve data•selections(selected rows(record))•display specific rows with all columns•display specific rows with specific columns•condition examplesSELECT * FROM tableWHEREcondition;SELECTcolumn_name1,column_name2, … FROM table_nameWHEREcondition;column_name="value"column_name<"value"column_name>="value"
SIMPLIFIEDMAPPING OFBASIC SQL QUERYTO RA•FROM <table list>•Joins the tables•WHERE <boolean expression>•Selects the rows•SELECT <column list>•Projects the columns
SELECT -NOTES•Each statement contains one or more clauses•Examples:•SELECT clause•FROM clause•WHERE clause•GROUP BY clause•HAVING clause•ORDER BY clause
SELECT -NOTES•Clauses are not evaluated in the order in which theyare written•Standard order of evaluation:1.FROM clause2.WHERE clause3.GROUP BY clause4.HAVING clause5.SELECT clause6.ORDER BY clause
SINGLE TABLE QUERY– EXAMPLE USING * AS TARGET LIST•Select all columns from all rows•SELECT specifies which columns•* indicates all columns•FROM specifies which table•There is no WHERE clause,so all the rows in the table are selectedSELECT * FROM Cat;
SINGLE TABLE QUERY– EXAMPLE USING COLUMN LIST•Select two columns from all rows•Name, Spayed specifies the columnsto be displayed (the column list)•There is no WHERE clause,so all the rows in the table are selectedSELECT Name, SpayedFROM Cat;
Upload your study docs or become a
Course Hero member to access this document
Upload your study docs or become a
Course Hero member to access this document
End of preview. Want to read all 60 pages?
Upload your study docs or become a
Course Hero member to access this document