Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Sphinx Search Beginner's Guide

You're reading from  Sphinx Search Beginner's Guide

Product type Book
Published in Mar 2011
Publisher
ISBN-13 9781849512541
Pages 244 pages
Edition 1st Edition
Languages
Author (1):
Abbas Ali Abbas Ali
Profile icon Abbas Ali

Table of Contents (15) Chapters

Sphinx Search
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Setting Up Sphinx Getting Started Indexing Searching Feed Search Property Search Sphinx Configuration What Next?

Time for action - creating database tables for a blog


  1. 1. Create the database by executing the following query:

    CREATE DATABASE myblog
    
  2. 2. Create the posts table:

    CREATE TABLE `myblog`.`posts` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `title` VARCHAR( 255 ) NOT NULL ,
    `content` TEXT NOT NULL ,
    `author_id` INT UNSIGNED NOT NULL ,
    `publish_date` DATETIME NOT NULL
    ) ENGINE = MYISAM;
    
  3. 3. Create the authors table:

    CREATE TABLE `myblog`.`authors` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `name` VARCHAR( 50 ) NOT NULL
    ) ENGINE = MYISAM;
    
  4. 4. Create the categories table:

    CREATE TABLE `myblog`.`categories` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `name` VARCHAR( 50 ) NOT NULL
    ) ENGINE = MYISAM;
    
  5. 5. Create the posts_categories table:

    CREATE TABLE `myblog`.`posts_categories` (
    `post_id` INT UNSIGNED NOT NULL ,
    `category_id` INT UNSIGNED NOT NULL ,
    PRIMARY KEY ( `post_id` , `category_id` )
    ) ENGINE = MYISAM;
    

What just happened?

We created a database to hold the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}