Ask for a SQL discourse.

Source: Internet
Author: User
To find an SQL statement:
Thought for a long time, there is no clue how to write.
I want to query the three tables of Discuz X2.0, respectively, the Pre_forum_thread,pre_forum_attachment Index table, Pre_forum_attachment_n's child table
SQL Code
  CREATE TABLE IF not EXISTS ' pre_forum_thread ' (' Tid ' mediumint (8) unsigned not NULL auto_increment, ' FID ' mediumint (8) unsigned NOT NULL default ' 0 ', ' posttableid ' smallint (6) unsigned NOT null default ' 0 ', ' typeid ' smallint (6) unsigned NO T null default ' 0 ', ' sortid ' smallint (6) unsigned NOT null default ' 0 ', ' readperm ' tinyint (3) unsigned NOT NULL default ' 0 ', ' Price ' smallint (6) is not null default ' 0 ', ' author ' char (all) NOT null default ' ', ' Authorid ' mediumint (8) unsigned Not null default ' 0 ', ' subject ' char (+) NOT null default ' ', ' Dateline ' int (ten) unsigned NOT null default ' 0 ', ' lastpo St ' int (ten) unsigned NOT null default ' 0 ', ' lastposter ' char (+) NOT null default ' ', ' views ' int (ten) unsigned NOT NULL Default ' 0 ', ' replies ' Mediumint (8) unsigned NOT NULL default ' 0 ', ' displayorder ' tinyint (1) NOT null default ' 0 ', ' hig Hlight ' tinyint (1) NOT null default ' 0 ', ' Digest ' tinyint (1) is not null default ' 0 ', ' rate ' tinyint (1) is not null default ' 0 ', ' Special ' tinyint (1) Not null default ' 0 ', ' attachment ' tinyint (1) is not NULL for default ' 0 ', ' moderated ' tinyint (1) NOT null default ' 0 ', ' Clos Ed ' Mediumint (8) unsigned NOT NULL default ' 0 ', ' stickreply ' tinyint (1) unsigned NOT null default ' 0 ', ' recommends ' smal Lint (6) NOT null default ' 0 ', ' recommend_add ' smallint (6) is not null default ' 0 ', ' recommend_sub ' smallint (6) is not NULL DEF Ault ' 0 ', ' heats ' int (ten) unsigned NOT null default ' 0 ', ' status ' smallint (6) unsigned NOT null default ' 0 ', ' isgroup ' tinyint (1) NOT null default ' 0 ', ' favtimes ' Mediumint (8) is not null default ' 0 ', ' sharetimes ' Mediumint (8) is not NULL Defaul T ' 0 ', ' Stamp ' tinyint (3) NOT NULL default '-1 ', ' Icon ' tinyint (3) NOT NULL default '-1 ', ' Pushedaid ' mediumint (8) not  Null default ' 0 ', ' cover ' smallint (6) NOT null default ' 0 ', ' replycredit ' smallint (6) NOT null default ' 0 ', PRIMARY KEY (' Tid '), Key ' Digest ' (' Digest '), key ' SortID ' (' SortID '), key ' Displayorder ' (' fid ', ' displayorder ', ' lastpost '), key ' typeID ' (' fid ', ' typeid '), ' Displayorder ', ' lastpost '), key ' recommends ' (' recommends '), key ' heats ' (' heats '), key ' Authorid ' (' Authorid '), key ' Isgroup ' (' Isgroup ', ' lastpost '), KEY ' Special ' (' Special ')) Engine=myisam DEFAULT Charset=utf8 auto_increment=380;


The pre_forum_attachment structure is as follows:
SQL Code
  
   CREATE TABLE IF not EXISTS ' pre_forum_attachment ' (  ' aid ' mediumint (8) unsigned not NULL auto_increment,  ' tid ' med Iumint (8) unsigned NOT NULL default ' 0 ',  ' pid ' int (ten) unsigned NOT null default ' 0 ',  ' uid ' mediumint (8) unsigned Not NULL for default ' 0 ',  ' tableid ' tinyint (1) unsigned NOT NULL for default ' 0 ',  ' Downloads ' Mediumint (8) NOT NULL Defaul T ' 0 ',  PRIMARY key (' aid '),  key ' tid ' (' tid '),  key ' pid ' (' pid '),  key ' uid ' (' uid ')) engine=myisam< C13/>default Charset=utf8 auto_increment=110;


The Pre_forum_attachment_n child table structure is as follows
SQL Code
  CREATE TABLE IF not EXISTS ' pre_forum_attachment_0 ' (' Aid ' mediumint (8) unsigned not NULL, ' tid ' mediumint (8) unsigned Not null default ' 0 ', ' pid ' int (ten) unsigned NOT null default ' 0 ', ' uid ' mediumint (8) unsigned NOT NULL default ' 0 ', ' d  Ateline ' int (ten) unsigned NOT null default ' 0 ', ' filename ' varchar (255) is not null default ' ', ' filesize ' int (ten) unsigned   Not null default ' 0 ', ' attachment ' varchar (255) is not null default ' ', ' Remote ' tinyint (1) unsigned NOT null default ' 0 ',  ' Description ' varchar (255) NOT NULL, ' readperm ' tinyint (3) unsigned not null DEFAULT ' 0 ', ' Price ' smallint (6) unsigned Not NULL for default ' 0 ', ' isimage ' tinyint (1) NOT NULL for default ' 0 ', ' width ' smallint (6) unsigned NOT null default ' 0 ', ' t Humb ' tinyint (1) unsigned NOT null default ' 0 ', ' picid ' Mediumint (8) is not null default ' 0 ', PRIMARY key (' aid '), key ' Ti d ' (' tid '), key ' pid ' (' pid '), Key ' uid ' (' uid ')) Engine=myisam DEFAULT Charset=utf8;
  • 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.