VALUES
Example
Section titled “Example”INSERT INTO employees (firstname, lastname, age)VALUES ('John', 'Doe', 30);Output
Section titled “Output”Query OK, 1 row affected (0.01 sec)Explanation
Section titled “Explanation”The provided MySQL statement inserts a new row into the employees table. The row’s values for firstname, lastname, and age columns are ‘John’, ‘Doe’, and 30, respectively. The output indicates that the operation was successful, with one row being affected.
Example
Section titled “Example”INSERT INTO Employee (id, name)VALUES (1, 'John');Output
Section titled “Output”INSERT 0 1Explanation
Section titled “Explanation”The INSERT INTO command adds a new row into the Employee table with the specified values. In this case, the new employee John with id 1 is added. The output message INSERT 0 1 indicates that one row is successfully inserted.
Example
Section titled “Example”CREATE TABLE Customers( CustomerID int, CustomerName varchar(255), ContactName varchar(255), Country varchar(255), Phone varchar(255));
INSERT INTO Customers (CustomerID, CustomerName, ContactName, Country, Phone)VALUES (1, 'Cardinal', 'Tom B. Erichsen', 'Norway', '555-98765');Output
Section titled “Output”Commands completed successfully.Explanation
Section titled “Explanation”In this example, a new table named ‘Customers’ is created first with five columns. Then, using the INSERT INTO statement together with the VALUES clause, one new row is added to the ‘Customers’ table. `
Example
Section titled “Example”INSERT INTO Employees (ID, FirstName, LastName, Age)VALUES (1, 'John', 'Doe', 35);Output
Section titled “Output”1 row(s) inserted.Explanation
Section titled “Explanation”The INSERT INTO statement was used to add a new row in the “Employees” table. The specific data (1, 'John', 'Doe', 35) was inserted into corresponding columns (ID, FirstName, LastName, Age). The output indicates that one row was successfully inserted into the table.