BBS tree structure Table Design

Source: Internet
Author: User

Create Database BBS;

Use BBS;

Create Table article
(
Id int primary key auto_increment,
PID int,
Rootid int,
Title varchar (255 ),
Cont text,
Pdate datetime,
Isleaf int
);

Insert into article values (null, 0, 1, 'Ant vs. elephant ', 'Ant vs. elephant', now (), 1 );
Insert into article values (null, 1, 1, 'elephant knocked down ', 'elephant knocked down', now (), 1 );
Insert into article values (null, 2, 1, 'Ant is not too bad ', 'Ant is not too bad', now (), 0 );
Insert into article values (null, 2, 1, 'taobao', 'taobao', now (), 1 );
Insert into article values (null, 4, 1, 'no taobao', 'no taobao', now (), 0 );
Insert into article values (null, 1, 1, 'How possible ', 'How possible', now (), 1 );
Insert into article values (null, 6, 1, 'How is it impossible? ', 'How is it impossible?', now (), 0 );
Insert into article values (null, 6, 1, 'likelihood is great ', 'likelihood is great', now (), 0 );
Insert into article values (null, 2, 1, 'elephant in hospital ', 'elephant in hospital', now (), 1 );
Insert into article values (null, 9, 1, 'nurse is ant', 'nurse is ant', now (), 0 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.