O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—Creating the Posts table

We will now create a table named Posts which will hold all our blog posts.

This table will have the following five fields:

  1. id: The ID of the post
  2. title: The post's title
  3. body: The post's text
  4. fk_author: This will contain the ID of the author
  5. postedOn: The date when the post was published

The following is the SQL query that you can use to create this table:

CREATE TABLE 'Posts' (
'id' int(11) NOT NULL AUTO_INCREMENT,
'title' text NOT NULL,
'body' longtext NOT NULL,
'fk_author' int(11) NOT NULL,
'postedOn' datetime NOT NULL,
PRIMARY KEY ('id')
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Our table will be set correctly with this query.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required