Within the routine of those who work with databases, some commands are indispensable for the activities to be carried out. Commands of query, insert, update and registration of exclusion are some of them and we will explain how each of them works in MySQL as following.


The SELECT command is used to return all the records of a particular table in the form of consultation. The syntax used in MySQL is:

SELECT [Fields]

FROM [Table]



FROM products

The command allows that all or certain columns are displayed. For that, you just need to indicate the name of each column or use the character (*), as shown in the previous example. It can still have a WHERE conditional, used in filters. With it, the only the record that meets the conditional will be displayed.


FROM products

WHERE code = 2

In the example, only the registration of the product table that has the code 2 will appear.


Inserting a record in MySQL is through the INSERT command. Tables, columns, and also the values that are stored on it are indicated.

INSERT INTO [Table] ([Columns]) VALUES ([Values]);


INSERT INTO product (code,name) VALUES (1,’television’);


The record update command in MySQL is the UPDATE. Its structure is shown below:

UPDATE [Table]

SET [Column] = [Value]

This more generic framework can be used to update all of the table at once, but this is totally inadvisable. Ideally, when you update a record in a table is that the WHERE conditional is present, thus avoiding possible failures.

UPDATE product

SET name = ‘TV’;

WHERE code = 1

In the example above, only the record with code 1 will have its value changed.


Just as the UPDATE command, the DELETE one will need to be used very carefully. This is because, when updating or deleting a database record, it may not be redeemed – only with restoring a backup that will be possible. The command syntax is very simple and should also be used with a conditional, as shown in the following example:

DELETE FROM [table] WHERE [conditional]


DELETE FROM product WHERE code = 1

Check out more content on our blog!
Learn all about Scriptcase.

By ,

June 15, 2015


You might also like…

How to Create and Read QR Codes and Barcodes

“Point your cell phone camera to read the QR code.” This phrase has been increasingly recurring...

Why is Low-Code essential for any business?

Low-Code is the IT term that refers to the process of using little code to develop software and app...

“The Preventus Medical Center system has more than 222,000 patients and 115 professionals.” (DRey Solutions)

Check out how DRey Solutions uses Scriptcase to streamline and synthesize the process of maintenanc...

You might also like…

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.