As you continue to work with SQLyog, you will notice that SQL statements, along with the time they have taken to execute, are getting recorded in the History tab of Result Window. Apart from logging the SQL that you have typed in the SQL window, SQLyog also logs all SQL that it sends to MySQL to provide you with a GUI interface. This helps a lot in a couple of things like:
- Profiling - You now know how much time a SQL statement took to execute. This information would be of great help in optimizing your queries, deciding when to create indexes, etc.
- SQL Tutorial - Looking at this log is probably the best way to learn MySQL! You can find out all the commands SQLyog sends to MySQL for displaying a GUI interface to you.
You can create a new Table in a database and alter the structure of an existing table in an easy to use Excel like GRID environment. To create a table in a database select the database in the Object Browser and select DB -> Create Table In The Database... or press (Insert).
Just fill in the details and Press Create Table. If you want to provide some advanced properties like Comment/Table Type/Checksum etc., you can do this by pressing Other Properties. It provides you with a dialog box that allows you to provide all table properties.
Similarly, alter the structure of an existing table by selecting the particular table in the Object Browser and select Alter Table Structure... or press (F6). Just change the details in the Grid and press Alter Table. To cancel the changes at any point of time while altering a table, press Cancel.
Indexes help the database store data in a way that makes for quicker searches. You can create/edit indexes in a table by using SQLyog's Index Manager. To view the existing Indexes in a table, select the table in Object Browser and select Manage Indexes from the popup menu.
To create a new Index press the New button. Check the column(s) on which you want to create the index. SQLyog is very flexible in index management. You can change the order of the columns by using the Up/Down button and even index on the first "n" characters of a column or make an Index Unique/Fulltext.
To edit an existing Index, select the Index and press the Edit button and apply your changes.