The names of all the fields are self-explanatory, so we'll only discuss the data types below. The statement is followed by the name of the table and all the columns are listed between the brackets. The CREATE TABLE statement is used to indicate we want to create a new table, of course. UNIQUE INDEX user_name_unique (user_name), A SQL introduction can be found at W3Schools.
sql files too, but I would recommend learning SQL because it's more fun to do it yourself. Some editors like MySQL Workbench (the one I used) can generate. For your own scripts you can create a similar scheme and SQL too. I'll discuss each table by explaining the SQL, which I created using the scheme above. I'll explain them further, so it's okay if it doesn't make a lot of sense to you right now. All the columns are listed in it and the lines between them represent the relationships. Looks pretty neat, huh? Every square is a database table. These three objects are related to each other, so we'll process that in our table design. As you can see, I highlighted a couple of nouns which represent our table names. Let's describe our application in one sentence: We are going to make a forum which has users who create topics in various categories. It's always a good idea to start with creating a good data model when building an application. This tutorial is perfect for getting used to basic PHP and database usage.
In this tutorial, we're going to build a PHP/MySQL powered forum from scratch.