How to create Table ,Insert , Update & Delete in MySQL|| MySQL Tutorial || Code With Neha

Published: 31 March 2025
on channel: Code With Neha
388
79

Today's video will be a recapitulation of the topics we have covered in mysql
So we will be covering the topics as
creation of database,
creation of table within a given database,
insertion of data into the table and so on
(Addition , modification and deletion of a column
Renaming table and column
And finally deletion of data ,truncate and drop of the table)
So without any further delay let's get started

1st creation of database and table

Using the query
Create database student_details1
Use student_details1
To use the database in the following query

Now to create a table within the given database using create table syntax

Create table student_details(
Std_id Integer Primary Key,
Std_name varchar (20),
Class Integer,
Marks Float,
Gender varchar(20),
Emailid varchar 255,
Class_teacher varchar 20
Address varchar(255)
);
Run the query to create table
To insert data to the table
Using insert into statement

Insert into student_details values ();
Using 6 insert into statement to insert 6 data set to the table

Inserting 1st set of data
Integer without single quote
String values within the single quote

Similarly insert other datas to the table as well And run the query

Select * from student_details to see the table

Now to add a column to the table
Using alter table syntax

Alter table student_details
Add column dateofbirth date;

Run the query
And see another column is added

Now to add details to the added column
Using update syntax

Update student_details
Set dateofbirth ='1997-08-05'
Where std_id = 1;

Here dataofbirth is the new added column and where clause is used to specify in which column the data needs to be inserted

Similarly use similar commands to update remaining 5 rows

Here you can see 2nd data is truncated
It's because I have inserted wrong date format
So changing it to 1998- 08-22

Now it's rectified



To change or modify the dara type of a column

Alter table student_details
Modify column std_name varchar (255);



To drop a column from the table

Alter table student_details
Drop column Dateofbirth

To rename a table


Alter table student_details
Rename to STUDENT_TABLE



TO rename a column to the table

Alter table STUDENT_TABLE
Change class_teacher classteacher varchar (255);

Delete data from the table

Delete from STUDENT_TABLE
Where std_id = 6;

Truncate table STUDENT_TABLE

Drop table STUDENT_TABLE

that's all for today Hope you all will get some help from this video
If it's so then don't forget to subscribe my channel Code with Neha and press the Bell Icon for Regular Updates
See you in the next video till then Stay Safe Stay Happy

#mysql
#mysqltutorial
#mysqldba
#mysqlserver
#mysqldb
#mysqldatabase
#learnsql
#learnmysql
#mysqltutorialforbeginners
#mysqldatabasetutorial
#mysql_workbench
#howtoinsertdataintotableinmysql
#insertdataintotableusingmysq
#insertdataintotableinmysql
#insertdataintotable
#mysqladddataintotable
#mysqlinsertdataintotable
#mysqlinsertquery
#mysqladdquery
#mysqlinsertquerywithexample
#mysqlinsert
#sqlinsertcommand
#mysqlinsertintocommand
#howtoinsertdataintableswithsql
#sqlbasics
#mysqlcourse
#mysqldatabasetutorial
#mysqlcrashcourse
#dbms
#selectquery
#sqlselectqueries
#selectcommandinsql
#sqlselectstatement
#whereclauseinsql
#wherequeryinsql
#wherecommandinsql
#SELECT
#FROM
#sqlselectstatement
#whereclauseinsql
#wherequeryinsql
#wherecommandinsql
#SELECT
#FROM
#sqlupdatecommand
#updatedatawithsql
#updatetabledatainmysql
#mysqldatabasetutorial
#updatingadatabase
#addingtablestoadatabase
#insertintostatement
#updatequeryinsql
#mysqlupdatequery
#whatisupdateinmysql
#sqlupdate
#mysqlupdatestatement
#mysqldatabase
#mysqlcourse
#mysqldatabasetutorial
#mysqlcrashcourse
#mysqltutorialforbeginners
#learnmysql
#learnsql
#SqlDMLcommands
#createinsertupdateinsql
#sqlupdatequery
#sqlcommands
#sqlqueries
#structuredquerylanguage
#sqlinterviewquestions
#sqlbasics
#sqlforbeginners
#insertrecordsinsql
#howtoupdateinsql
#howtodeleteinsql
#howtoinsertupdatedeleteinsqldeleterecordsinsql
#SqlDMLcommands
#createinsertupdateinsql
#sqlupdatequery
#sqlcommands
#sqlqueriesstructuredquerylanguage
#sqlinterviewquestions
#sqlbasics
#sqlforbeginners
#howtoinsertdatainsqlserver
#howtodeleteinsqlserver