MySQL UPDATE Query

MySQL UPDATE Query MySQL UPDATE statement is used to update data of the MySQL table within the database. In real life scenario, records are changed over the period of time. So, we need to make changes in the values of the tables also. To do so, we need to use the UPDATE statement. The UPDATE … Read more

MySQL INSERT Statement

MySQL INSERT Statement MySQL INSERT statement is used to insert data in MySQL table within the database. We can insert single or multiple records using a single query in MySQL. Syntax: The SQL INSERT INTO command is used to insert data in MySQL table. Following is a generic syntax: INSERT INTO table_name ( field1, field2,…fieldN ) VALUES ( value1, value2,…valueN ); Syntax for all … Read more

MySQL View

MySQL View In MySQL, View is a virtual table created by a query by joining one or more tables. MySQL Create VIEW A VIEW is created by SELECT statements. SELECT statements are used to take data from the source table to make a VIEW. Syntax: CREATE [OR REPLACE] VIEW view_name AS SELECT columns FROM tables [WHERE conditions]; Parameters: OR REPLACE: It is optional. … Read more

MySQL DROP Table

MySQL DROP Table MYSQL DROP table statement removes the complete data with structure. Syntax: DROP TABLE  table_name; Example: DROP TABLE  cus_tbl; MySQL TRUNCATE Table vs DROP Table You can also use DROP TABLE command to delete complete table but it will remove complete table data and structure both. You need to re-create the table again if you have to … Read more

MySQL TRUNCATE Table

MySQL TRUNCATE Table MYSQL TRUNCATE statement removes the complete data without removing its structure. The TRUNCATE TABLE statement is used when you want to delete the complete data from a table without removing the table structure. Syntax: TRUNCATE TABLE  table_name; Example: This example specifies how to truncate a table. In this example, we truncate the table “cus_tbl”. … Read more

MySQL ALTER Table

MySQL ALTER Table MySQL ALTER statement is used when you want to change the name of your table or any table field. It is also used to add or delete an existing column in a table. The ALTER statement is always used with “ADD”, “DROP” and “MODIFY” commands according to the situation. 1) ADD a … Read more

MySQL CREATE TABLE

MySQL CREATE TABLE The MySQL CREATE TABLE command is used to create a new table into the database. A table creation command requires three things: Name of the table Names of fields Definitions for each field Syntax: CREATE TABLE table_name (column_name column_type…); Example: Here, we will create a table named “cus_tbl” in the database “customers”. Note: Here, NOT NULL … Read more

MySQL Drop Database

MySQL Drop Database You can drop/delete/remove a MySQL database easily with the MySQL DROP DATABASE command. It deletes all the tables of the database along with the database permanently. Syntax: DROP DATABASE database_name; Example: Let’s take an example to drop a database name “employees” DROP DATABASE employees; Now you can check that either your database is removed by executing … Read more

Installing MySQL on Windows

Installing MySQL on Windows Your downloaded MySQL is neatly packaged with an installer. Download the installer package, unzip it anywhere and run setup.exe. By default, this process will install everything under C:\mysql. Verify MySQL installation Once MySQL has been successfully installed, the base tables have been initialized, and the server has been started, you can … Read more

MySQL –Administration

MySQL 13Runningand Shutting down MySQL Server MySQL 13Runningand Shutting down MySQL ServerFirst check if your MySQL server is running or not. You can use the following command to check it:                        ps -ef | grep mysqld If your MySql is running, then you will seemysqldprocess listed out in your result. If server is not running, … Read more