Hi friends how are you? Hope you are doing good, today i am going to share a very important and useful things with you. If you are beginners in mysql, then this tutorial is best for you. Below i have explained some important MYSQL Query Syntax with examples.
1) SELECT – Select data from a table
2) UPDATE – updates data in a table
3) DELETE – delete data from a table
4) INSERT INTO – inserts new data into a table
5) CREATE DATABASE – creates a new table
6) ALTER DATABASE – modifies a table
7) CREATE TABLE – creates a new table
8) ALTER TABLE – modifies a table
9) DROP TABLE – deletes a table
Open the phpmyadmin and create a table using the below code.
1 2 3 4 5 6 | CREATE TABLE employees ( emp_id int, emp_name varchar(255), salary varchar(255) ); |
The INSERT INTO statement is used to insert new records in a table.
1 | "INSERT INTO employees(emp_name,salary)VALUES('Robert','10000')"; |
Below example select the all data from the employees table
1 | SELECT * FROM employees; |
Below example delete the matched data from the employees table
1 | DELETE FROM employees WHERE emp_name="Robert"; |
Below example Update the existing data from the employees table.
1 | UPDATE table_name SET emp_name="Prem" WHERE emp_name="Robert"; |
Thank you for giving time on Freewebmentor community. Please don’t forget to subscribe our newsletter or join us on Facebook to be the first to learn the next great thing from freewebmentor.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: mysql delete query, mysql insert query, mysql query example, Mysql Query Syntax, mysql select query, mysql tutorial, mysql update query