Sqlnotes 1
Sqlnotes 1
Sqlnotes 1
Note: Please use these notes as a reminder of work already learnt, do not study from these notes
alone.
SELECT:
FROM:
<tableName>
WHERE:
ORDER BY:
<field1>, <field2>
ASC and DESC
GROUP BY:
SELECT
YEAR/MONTH/DAY/HOUR/MINUTE/SECOND (dateTimeValue)
ie YEAR (<field Value>) isolates the year from that value
NOW () can also be seen as a variable
EG
o SELECT DOB,
YEAR (DOB) AS Year,
(NOW ()- DOB)/ 365.25 AS ActualAge
INSERT INTO:
VALUES <Values>
SELECT <fields>
FROM <tableName>
WHERE <Conditions>
Eg:
FROME PrintLogs
This adds records for Joe that are exactly the same as Faiths
UPDATE:
UPDATE <tableName>
WHERE <condition>
DELETE :
WHERE <condition>