Adding Data into SQL Database

This is the part of where I would demonstrate how I would add data into SQL, right from scratch. And if there is any of these that requires change, I would also demonstrate how I would alter these newly-added data.

Ian Ng

5/4/20252 min read

white concrete building
white concrete building

Sometimes, We Need More Tables To Put More Data

Here I will be doing some manual work with data.

There are some situations where a new set of data is acquired, and then the existing tables in your SQL database are not suitable to fit these new data. This is where you will need to create a new table.

This part of writing script is called DDL, the data definition language.

Now for example, I have a bunch of new data that I wanted to enter into this football players schema, in another table. First, I would create the new table, then insert the new data values into the table:

Now I have entered a few players' details into the table:

Then, for the need to add some columns in an existing table, for example, a new column of data needs to be inside this table/someone forgot to enter this column into said table, I would use this to add the column in:

added a few more info into 'speed' column, am pretty sorry de Bruyne's name was misspelled during data entry, but these are all fictional data from these players from another multiverse:

Then, later i found out that there is a need to change the data type in a certain column to accommodate certain type of characters, I would do such change:

ALTER TABLE players

MODIFY contact VARCHAR(10);

This modification enables me to enter hypens into the contact numbers in the 'contact' column, to make the numbers look better.

Then some time later, this table becomes obsolete, as the data inside no longer is meaningful, but a new set of data can still be input here, I would do this:

TRUNCATE TABLE players;

This table is now empty(take note that the new column is still there):

And finally, I would like to remove this entire table, for it is no longer relevant:

DROP TABLE players;

The table no longer exists in the database once this is executed.