Database
-
Table1
- Fields . . .
-
Table2 . . . .
-
Has a similar structure with spreadsheet software (e.g. Excel)
- Database is relatively more complicated as compared with spreadsheet software
- Database isn't able to generate charts (however spreadsheet software can)
- Database is good at handling large amount of data.
- Spreadsheet software is slow in handling large amount of data.
- It is also hard to share data across sheets in spreadsheet software.
-
With proper commands, one can easily filter data he/she needs.
-
Database is usually used to store large amounts of data, and spreadsheet software is usually used to generate human-readable reports.
-
Filter names
- Data types are case-sensitive on data type. It should be in text or number.
- If you use wrong data type, no data will be saved.
-
Key / primary field
- Fields contains data that's needed, and are all unique.
- It is possible to combine two key fields. (For example, combining class and class number will create a unique key field.)
- If there is no key field, you can give the data a unique ID (e.g.
0001) to classify the data.
Before we start, these are mostly shared in C(++) so if you have knowledge in C(++) it should be relatively easy.
INT(Stands for integer , no decimal places will be stored.)INT 24.96will be stored as 24.
FLOAT(Stands for float, can store decimal places.)FLOAT 24.96will be stored as 24.96.
TEXT(Stands for text. Can store any character / symbol. Uses relatively more space thenCHARasTEXTreserves space for large strings)CHAR(Stands for character. Does not work without supplying character length.)DATE(Stands for date. Only takes input in the formatYYYY-MM-DD)- There are still lots of data types in database. However, only the 5 listed above will be tested in DSE (usually).
- SQL stands for "Structured Query Language".
SELECT- Used to select data from database.
- Usage:
- To show the names of
Studentsin the databaseRecordSELECT Students FROM Record;
- To show the different
Sexin the databaseRecordSELECT DISTINCT Sex FROM Record;
- To show the names of
DELETE- Used to delete data from database.
- Usage:
- To delete from the database
RecordifSexisMDELETE FROM Record WHERE Sex='M';
- To delete all records in the table
RecordDELETE FROM Record;
- To delete from the database
INSERT- Used to insert data into database.
- Usage:
- To insert
piginto the databaseRecordwith the columnsNameandTypeINSERT INTO Record (Name, Type) \n VALUES ('pig', 'boar');
- To insert
UPDATE- Used to update values in database.
- Usage:
- To update the type
Typetosaber simpwhere typeNameispigin the databaseRecordUPDATE Record \n SET Type='saber simp' \n WHERE NAME='pig';
- To update the type
made by tkt0506 and only tkt0506