We have seen how to use database and also how to create a table in that database. If you want to recall this you can refer in the following link.
Now we can insert values into that players table. Let’s see how!!!. Before this you just make sure that schema of the table players as shown in below:
To insert the values to the players table there is a command called INSERT INTO and the syntax for the same is as follows:
|INSERT INTO table_name VALUES ( value1, value2,…valueN );|
Similarly we can insert the remaining values. To display all the values from the table we use select command and the syntax for select is:
|select * from table_name;|
Now the players table would be like:
If we specify NULL value in the ‘name’ field it displays null value instead the respective value.
Now the table will be as follows:
If you want to insert only two columns in the players table then use the following syntax;
|INSERT INTO table_name ( field1, field2,…fieldN ) VALUES ( value1, value2,…valueN );|
Now using select command we can display the ‘players’ schema and it is as follows;
Here we are not specifying any NULL values, so MySQL server takes NULL value as default.
If you want to insert multiple values at a time:
Now, display the players schema:
To watch this tutorial post on YouTube Channel.