In the last post, we have seen that how we can create a table and add the data. In this post, we will see how we can handle that data, and as well as how we can handle the operations on tables in XMAPP.
In the last post, we added one record in the employees table which is in codetej database. I have added some more records inside that table.
Now, to edit any record you can click on any field and it will be editable, you can provide your new value in there and click outside the table. That row will get updated.
Also, there is another way to update the record. If you want to edit a particular record you can click on the edit button which is present in that row. Else you can select any record by clicking on the checkbox of that particular row, and then can click on the edit button which is below the table.
After clicking on edit you will get the interface like below you can edit the row and can click on Go.
Now, to delete any record we follow the same procedure as edit. If you want to delete any record simply click on the delete button present in that row. Else you can select any row by clicking on the checkbox and then you can delete the selected record using the delete button which is below the table. After clicking on delete you will get to see the pop-up, you can click on Ok. Then the expected record will get deleted.
Now, click on the Structure tab to see the structure of the table. In structure, you can see the column name, its type, and other attributes.
If you want to delete any column you can click on the Drop button and that column will be deleted from our table. Also if you want to edit any column you can click on the Change button. Making changes to an existing table is know as altering the table.
After clicking on the change you will get to see the information related to that column, you can edit it and click on the Save button.
Now, if you want to add a new column in that table only. Then you will get to see the option below the table. There select the column number you want to add and then select the column after which you want to add new columns. Below I am adding 1 column after column empMobileNumber.
Add the attributes for the new column empAddress and click on save.
As you can see above after the column empMobileNumber, column empAddress is added.
After that select the table from the left bar and click on the operations tab. Here I have selected the employee table which is under the codetej database. There the first option is Move table to, you can select the database in which you want to move the table and click on Go after selecting appropriate options. Remember your table will be removed from the previous database and you will get to see that table in the database you have selected.
From the Table Options section, you can do several things like renaming the table name, changing the storage engine, and many more.
Copy table is another option to replicate the table. In this, you need to select the database and table and can copy that table into the selected database. Unlike move table to your table will exist in both the databases since we are copying the table.
Next is table maintenance you can analyze the table, check the table, etc.
After that, there is an option to delete the table or truncate the table. Delete table will delete the entire table and truncate table will delete the data inside the table.
So these were the basic operations related to the table and the ways to handle the data inside the table.