Mysql
Mysql
RDBMS Terminology
Before we proceed to explain the MySQL database system, let us revise a few definitions
related to the database.
Table: A table is a matrix with data. A table in a database looks like a simple
spreadsheet.
Column:Field – Attribute :One column contains data of one and the same kind,
for example the column Name, Roll.
Constraints:
Constraints are the condition which are defined when creating table and applied by the sql
automatically when data is insert or update in a table to ensure validity of the data, called Constraints.
Primary Key
Not null
Unique
Default
Foreign key
Create table student(
Rollnoint Primary key,
Name varchar(25) Not Null,
Email varchar(25) unique,
Hobby varchar(25) default ‘Music’);
Foreign key:
Primary Key: In a primary key we cannot store null and duplicate value.
Alternate Key: One of candidate is selected as primary key remaining are known as
alternate.
Foreign Key: in a foreign key column we can store only those value which are already
stored in primary key this primary key and foreign key are define when creating table.
Referential Integrity: Referential Integrity makes sure that a foreign key value always
points to an existing row.
TINYINT − A very small integer that can allowable range is from -128 to 127.
SMALLINT − A small integer that can be allowable range is from -32768 to 32767.
BIGINT − A large integer that can be signed or unsigned. If signed, the allowable range is
from -9223372036854775808 to 9223372036854775807.
Drop Delete
DDL Command DML Command
To drop Structure To delete Data