MySQL,
A database is an organized collection of data that allows for easy access,
management, and updating. It stores information in a structured way, typically
using tables, so users can retrieve and manipulate data efficiently. Databases are
managed using Database Management Systems (DBMS) like MySQL,
PostgreSQL, and SQL Server.
The image explains the types of databases, categorized into:
1. Relational Databases (RDBMS) – Data is stored in tables and follows a
structured format with relationships between data.
o Examples: MySQL, SQL Server, Oracle, PostgreSQL
o Uses SQL for managing data.
2. Non-relational Databases (NoSQL) – Data is not stored in tables and
follows a flexible schema, often in document, key-value, or graph formats.
o Example: MongoDB
SQL is used to interact with relational databases, while NoSQL databases use
different querying methods.
The image provides SQL commands for creating and deleting a database:
1. Creating a Database
2. CREATE DATABASE db_name;
o This command creates a new database with the specified name.
3. Dropping a Database
4. DROP DATABASE db_name;
o This command deletes an existing database along with all its data.
Let me know if you need further clarification!
#
The image provides SQL commands for creating a table:
1. Using a Database
2. USE db_name;
o This selects the database where the table will be created.
3. Creating a Table (General Syntax)
4. CREATE TABLE table_name (
5. column_name1 datatype constraint,
6. column_name2 datatype constraint,
7. column_name3 datatype constraint
8. );
o Defines a new table with specified columns, data types, and
constraints.
9. Example: Creating a "student" Table
10.CREATE TABLE student (
11. id INT PRIMARY KEY,
12. name VARCHAR(50),
13. age INT NOT NULL
14.);
o id: Integer and set as the primary key.
o name: Variable character field with a max length of 50.
o age: Integer and cannot be NULL.
Let me know if you need further clarification!
Here’s an example of the student table with
some sample data:
Table Structure
CREATE TABLE student (
id INT PRIMARY KEY,
name VARCHAR(50),
age INT NOT NULL
);
Inserting Sample Data
INSERT INTO student (id, name, age) VALUES
(1, 'Pratik Kumar', 25),
(2, 'Amit Sharma', 22),
(3, 'Neha Singh', 23),
(4, 'Rahul Verma', 24);
Resulting Table
i ag
name
d e
Pratik
1 25
Kumar
Amit
2 22
Sharma
Neha
3 23
Singh
Rahul
4 24
Verma
Let me know if you need modifications! 🚀
I wrote the code
Asked deepseek to correct