Database basics
What is a database?
Database is a collection of related data organized in a way that the data can be easily accessed, managed and updated. So the computer program can easily and quickly find access to the needed data.
One can organize data into tables, rows, columns, and index it to make it easier to find relevant information.
The organized collection of structured data that is stored & accessed electronically to manage a database more efficiently called database.
Database handlers create a database.
The main purpose of the database is to operate a large amount of information by storing, retrieving, and managing data.
Example of database-
Student details like
Name
Roll number
Address
Contact
Age
Gender
Elements of database-
Character (alphabet or numbers)
Fields (stores one type of details)
Records (collection of related fields)
Files(a collection of related records)
Database (a collection files)
What is SQL?
SQL stands for “structured query language” every relational database software interacts with a language SQL, because it is a simple English like language which guidelines are provided by a standard organizational “ANSI” adopted by all database vendors like Oracle, mySQL, microsoft etc.
My SQL is a very complex language to reduce its complexity.
It can be categorized into 5 sub languages.
DDL (Data definition language)
CREATE, DROP, TRUNCATE, ALTER, RENAME.
DML (Data manipulation language)
INSERT, UPDATE,DELETE
DQL (Data query language)
SELECT
DCL (Data control language)
GRANT, REVOKE
TCL (Transaction control language)
COMMIT, ROLLBACK, SAVE POINT
Some basic SQL commands-
SELECT- to retrieve data.
INSERT- to add new data.
UPDATE- to modify existing data.
DELETE- to remove data.
CREATE- to make new tables or databases.
Example of SQL -
SELECT * FROM students;
This retrieves all records from the students table.
What is MySQL-
MySQL is a relational database management system used to manage databases.
It is open-source management. This means it is free to use. It is essential for web developers because several applications and the web are built on databases.
MySQL is a popular open-source relational database management system(RDBMS) that uses SQL to manage data. It's widely used in web development, often with PHP and Apache in a LAMP stack(linux, Apache, MySQL, PHP)
What does MySQL do?
Here's an illusion-
A movie program such as Netflix, stores and transmits movies, documentaries, TV shows on different devices.
You can search easily for movies by using parameters like movie name, actor, genre etc.
Apps like that need software to manage their SQL database.
Basic MySQL concept-
Database- A collection of related tables.
Table- A collection of rows and columns.
Row- A single record in a table.
Column- A field in a table.
Example: creating a table in MySQL-
CREATE TABLE students (
id INT AUTO_INCREMENT,
name VARCHAR(100),
age INT,
PRIMARY KEY (id)
);
MySQL vs SQL
SQL is a language.
MySQL is a software that implements SQL.