Database - An organised collection of inter-related data that ensures safety , security and integrity of data.
DBMS - software that provides essential services to create, maintain and manage the database.
Advantages:
Relation Database - Data organised as tables
Terminology
Relational Database Management system - software which provides essential tools to create, manage and maintain data in the form of tables
Keys:
Keys are attributes that allow us to identify an attribute or set of aatributes.
Different types of keys:
Primary Key - an attribute or a set of attribute that allows us to uniquely identify a tuple or row in a table. They are unique , cant be duplicated.
Candidate Key - attributes which can be selected as the primary key
Alternate Key - candidate key which is not selected as primary key
Foreign Key - attribute of a table that is the primary key of another table
Parent table - primary key
Child table - Foreign key
SQL (Stuctured query language):
MySQL
Data types - numeric and non numeric
NUMERIC
Interger: positve 11 and negative 10
Numeric [Number(x,y)]: x - how many , y - decimal , 1 for decimal point
Decimal - same
NON-NUMERIC
char(x): fixed length
varchar(x): variable length
Date: ‘yyyy-mm-dd’
Datetime: ‘yyyy-mm-dd hh:mm:ss’
SQL commands:
DDL - definition - create, delete, change the structure - create, drop, alter , crete database, use database
DML - manipulation - insert, update, delete data within the database.
DCL - control - grant permissions and control access to the database, including commands such as GRANT and REVOKE.
TCL - transaction control - manage transactions in a database, ensuring data integrity through commands like COMMIT, ROLLBACK, and SAVEPOINT.
DQL - query - select (extract data)