RDMS – Relational Database Management System
ex.
SQLlite & MySQL – free open source
Structured Quarry Language – a language used to ask the database questions
ex.
Oracle/DB2 – propriatory, very expensive
All implement about 80% of sqlanguage in the same way, the remainder varies.
Database Management SystemsEach database contains tables.
The tables contain the data, so a table can be considered a separate database.
The tables are not neccessarily connected. Each table contains one kind of information.
In a relational database name, address, photo etc, would all be in separate tables.
A relational DMS can describe the relationships between the tables.
(Chapter 7 in MySQL)
A table contains rows and columns, where columns are fileds (describe content) and rows are records.
ex. Field – Last_Name: Record – Sheptytsky-Zall
Field Name can not contain spaces. The contents may or may not allow spaces depending on the filed type.
Every record in a database has to be unique (unlike a spreadsheet)
Nothing inherent about a database that can allow calculations, it can be set up within the database.
Primary Key
Auto Incrementing by the database – a unique number that the database uses to make sure that there are no duplicate records.
This number is not used by the user as much as it is by the system.
As a convention, the field containing a Primary Key should always end with ‘ID’, almost always type ‘INT’ for interger.
Data Types – most common
INT – whole number
TEXT – a character based format
BLOB – a binary format that can hold character or image (use more processing power)
VARCHAR – variable character length (length can be set to save memory but uses more processing power)
CHAR – reserve space for XX characters
Max for mySQL is 255 in char and varchar
FLOAT – floating point number, any number with a decimal point. Don’t use more less than 4 digits after the decimal.
DATE – able to calculate dates
Do not change the data types once data has been input unless you are giving more space for characters.
Naming Conventions – Database, Tables, Fields
Make it descriptive- explicitly state what they contain.
Make it readable
Camel Text – lowerCase, firstName – instead of a space capitalize every subsequent word
or first_name, lower_case