MySQL Background Theory 12
MySQL Background Theory 12
1. What is My-SQL? Write different data types used in My-SQL. TRUNCATE: The truncate command deletes the data in a table,
MySQL is a popular open-source database management system which is but not the table itself.
used for storing and organizing data. It is used to create and modify Syntax:
databases, tables and other database objects. The different data types TRUNCATE TABLE table_name;
used in MySQL are INT, STRING, VARCHAR, FLOAT, DOUBLE, etc. Example:
2. What are DDL commands? Explain some DDL commands with syntax and TRUNCATE TABLE Categories;
examples. (CREATE, DROP, ALTER, TRUNCATE, RENAME) RENAME: It is used to rename a table:
The DDL commands are the commands that are used to create and Syntax:
modify the schema of the database and its objects. Some DDL commands ALTER TABLE old_name RENAME new_name;
are: Example:
Create command: CREATE is a DDL command used to create ALTER TABLE students RENAME students_info;
databases, tables, triggers and other database objects.
Syntax: CREATE Database Database_Name; 3. What are DML commands? Explain some DML commands with syntax and
Example:
examples. (INSERT, UPDATE, DELETE)
CREATE TABLE Persons (
PersonID int, DML is short name of Data Manipulation Language which deals with
LastName varchar(255), data manipulation and includes most common SQL statements such
FirstName varchar(255), SELECT, INSERT, UPDATE, DELETE, etc., and it is used to store,
Address varchar(255), modify, retrieve, delete and update data in a database. Some DML
City varchar(255) commands are:
); INSERT: It is used to insert data into a table.
DROP: Drop is a DDL command used to delete/ remove the Syntax:
database objects from the SQL database. We can easily remove the INSERT
entire table, view, or index from the database using this DDL UPDATE: It is used to update the existing data into the table.
command. DELELTE: It is used to delete all records from a database table.