Advertisement
Shaun_B

SQL file for simple blog site example

Oct 24th, 2012
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.61 KB | None | 0 0
  1. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  2. --
  3. -- Database: `blogdb`
  4. --
  5. -- Please see this tutorial:
  6. -- net.tutsplus.com/tutorials/php/how-to-create-an-object-oriented-blog-using-php/
  7. -- --------------------------------------------------------
  8. --
  9. -- Table structure for table `blog_posts`
  10. --
  11. CREATE TABLE `blog_posts` (
  12.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  13.   `title` VARCHAR(255) NOT NULL DEFAULT '',
  14.   `post` text NOT NULL,
  15.   `author_id` INT(11) NOT NULL DEFAULT '0',
  16.   `date_posted` DATE NOT NULL DEFAULT '0000-00-00',
  17.   PRIMARY KEY  (`id`)
  18. ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
  19. --
  20. -- Data for table `blog_posts`
  21. -- Dates work on YYYY-MM-DD
  22. --
  23. INSERT INTO `blog_posts` (`id`, `title`, `post`, `author_id`, `date_posted`) VALUES
  24. (1, 'This is my first post', 'Hello, and welcome to the world of PHP', 1, '2012-05-17'),
  25. (2, 'Web designer', 'The World Wide Web was first though up by computer scientist Sir Tim Berners-Lee, who proposed a system of hypertext systems to work on the Internet in the late 1980s.', 1, '2012-05-17'),
  26. (3, 'The importance good design', 'Good, appealing web design works for the masses, and not the classes.', 1, '2012-05-17');
  27. -- --------------------------------------------------------
  28. --
  29. -- Table structure for table `blog_post_tags`
  30. --
  31. CREATE TABLE `blog_post_tags` (
  32.   `blog_post_id` INT(11) NOT NULL DEFAULT '0',
  33.   `tag_id` INT(11) NOT NULL DEFAULT '0'
  34. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  35. --
  36. -- Data for table `blog_post_tags`
  37. --
  38. INSERT INTO `blog_post_tags` (`blog_post_id`, `tag_id`) VALUES
  39. (2, 1),
  40. (3, 2);
  41. -- --------------------------------------------------------
  42. --
  43. -- Table structure for table `people`
  44. --
  45. CREATE TABLE `people` (
  46.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  47.   `first_name` VARCHAR(255) NOT NULL DEFAULT '',
  48.   `last_name` VARCHAR(255) NOT NULL DEFAULT '',
  49.   `url` VARCHAR(255) NOT NULL DEFAULT '',
  50.   `email` VARCHAR(255) NOT NULL DEFAULT '',
  51.   PRIMARY KEY  (`id`)
  52. ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  53. --
  54. -- Data for table `people`
  55. --
  56. INSERT INTO `people` (`id`, `first_name`, `last_name`, `url`, `email`) VALUES
  57. (1, 'Shaun', 'Bebbington', 'http://www.metapps.co.uk/', 'shaun.bebbington@metap.com');
  58. -- --------------------------------------------------------
  59. --
  60. -- Table structure for table `tags`
  61. --
  62. CREATE TABLE `tags` (
  63.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  64.   `name` VARCHAR(255) NOT NULL DEFAULT '',
  65.   PRIMARY KEY  (`id`)
  66. ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  67. --
  68. -- Data for table `tags`
  69. --
  70. INSERT INTO `tags` (`id`, `name`) VALUES
  71. (1, 'Web Design'),
  72. (2, 'PHP'),
  73. (3, 'World Wide Web');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement