- Database intro
- Tables, Columns, Rows, Values, Keys, Schemas
- Relationship: 1-1, 1-many, many-many
- database diagram, database dictionary
- database fundamentals
- mySQL monitor : c:\xampp\mysql\bin -> mysql.exe -u root [-p]
- create database, drop
- php connect to mySQL DB
- mySQL Administration DCL: create user, grant ... to, revoke ... from, privileges
- Storage Engines/Table Type : myisam, innodb
- Data Types :
- numeric - tinyint(bool), int
- float - float(m,d, double)
- date & time: date, time, datetime, timestamp
- string: char(fix length char), varchar; text, blob[binary large object:example-image]
- DDL: create, alter, drop table
Day 22-23:
- DML: insert, update, delete
- DQL: select ... where
- indexing
- keyword:
- null, not null, auto_increment, unsigned(int)
- distinct, order by asc|desc, limit
- operator:
- =, >, <, >=, <=, !=,
- is null, is not null, between, in, not in, like("%"), not like, regexp
- join type: union, inner join, left join
- grouping & aggregating
- group by... having
- avg(), count(), min(), max(), sum()
- subqueries: any, in , some, all
Day 24-25:
- mySQL functions
- mySQL tips
- foreign keys(pg315) in innoDB: references tablename(colname)
- stored Procedure & Cursors
1a.htm 3b
ReplyDeleteselect name, region, population from bbc a
where (select sum(population)
from bbc b
where a.region=b.region) < 250000000
1a.html 3c
ReplyDeleteSELECT name, region FROM bbc x
WHERE population > 3 *
(SELECT population
FROM bbc y
WHERE x.region=y.region
ORDER BY population DESC limit 1,1)
SELECT name, region, population
ReplyDeleteFROM bbc x
WHERE 25000000 >= ALL (SELECT population
FROM bbc y
WHERE x.region=y.region)
http://www.sqlzoo.net/2b.htm
ReplyDelete5a
SELECT yr, subject FROM nobel
WHERE yr>='2000'
GROUP BY yr, subject
HAVING COUNT(subject)=3