I have a problem creating the table. It says unexpected parenthesis at line 3  CREATE DATABASE scl_teachers;  USE scl_teachers;  CREATE TABLE clteacher (     'id' INT (10) PRIMARY KEY auto_increment,     'f_name' VARCHAR(255) NOT NULL,     'mid_initials' (255) IS NULL,     'l_name' VARCHAR(255) NOT NULL,     'saturation' VARCHAR(2) );
62223
In MySQL we can create queries with or without the backtick (`) symbol. Example:   SELECT * FROM TEST; SELECT * FROM `TEST`;   Both works fine in mysql-console.  Is there any technical difference between them?  Is there any benefit using (`) over over simple queries?
120116
Problem:  Is there any way of calculating number of bytes occupied by the table creation, i know that you can get some information from information_schema.tables but that information is not accurate enough.             What actually required is the number of bytes according to the definition of the table for innodb only and collation could also be considered as utf-8-general-ci  For example a table test is as following     create table test   (   col1 varchar(25),   col2 int,   col3 varchar(3),   col4 char(15),   col5 datetime   );     Now would require to know the total row size that can be accumulated in one row according to the types of columns in the table.  Found a some sort of similar solution in MSSQL but need its MySQL version    Any help is much appreciated.
114689
I am practising in writing a simple forum and just can't decide on table structure. Currently I have this:      id  int(11)     AUTO_INCREMENT           title   varchar(56)      group_id    int(11)     group_parent    tinyint(1)     access_from int(11)      alliance_forum  tinyint(1)                alliance_id int(11)     alliance_role_access    int(11)   Group parent is a 0 or 1 column which states wherever a forum is parent of forums, and group id is for group forums whch reffers to same table to record with group parent set to 1. Alliance forum is same as group parent, as the alliance id,and access column are for access control. Which would be the best and perfomant way of restructuring this? Should I mak 3 different tables for alliance forums, forum_groups and group_forums or keep it this way? P.s. Please remove my  another same question.
103971
CREATE TABLE plan    (       id                VARCHAR(30) NOT NULL,       name              VARCHAR(20),       amount            INT,       interval          INT,       currency          CHAR(3),       object            VARCHAR(20),       livemode          BOOLEAN,       interval_count    INT,       trial_period_days INT,       created           TIMESTAMP,       updated           TIMESTAMP,       deleted           TIMESTAMP,       PRIMARY KEY (id)    );    Produces   'ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval          INT,       currency          CHAR(3),       object            ' at line 6'   Doesn't work. However if the 'l' at the end of 'interval' is removed. It works.  CREATE TABLE plan    (       id                VARCHAR(30) NOT NULL,       name              VARCHAR(20),       amount            INT,       interva           INT,       currency          CHAR(3),       object            VARCHAR(20),       livemode          BOOLEAN,       interval_count    INT,       trial_period_days INT,       created           TIMESTAMP,       updated           TIMESTAMP,       deleted           TIMESTAMP,       PRIMARY KEY (id)    );    I don't understand if this is a problem with attempting to use 'interval' and 'interval_count'. What's going on here.
108468
I'm getting an error when using this entity field query, the error says that that the field title cannot be found but I'm only querying the basic node table.  $product_query-&gt;entityCondition('entity_type', 'node')-&gt;entityCondition('bundle', 'product')-&gt;fieldCondition('field_line', 'tid', $selected)-&gt;fieldOrderBy('title', 'DESC');
45652
I would like to create the following table bases on the answer of @Zarko  since i use the same code for another kind of table     \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[table]{xcolor} \usepackage{tabularx} \usepackage{enumitem} \usepackage{etoolbox} \AtBeginEnvironment{center}{%     \setlist[itemize,1]{nosep,                         topsep     = 0pt,                         partopsep  = 0pt,                         leftmargin = *,                         label      = \textendash,                         before     = \vspace{-0.6\baselineskip},                         after      = \vspace{-\baselineskip}                         }     \setlist[itemize]{  nosep,                         leftmargin=*,                         label = $\bullet$                       } }  \begin{document}     \begin{center} \bfseries \begin{tabularx}{\linewidth}{ | l | X |X| }     \hline \multicolumn{2}{|&gt;{\centering\arraybackslash}%                  p{\dimexpr\linewidth-2\tabcolsep-2\arrayrulewidth\relax}|}{\cellcolor{gray!30}     Very long text here and centered     Very long text here and centered     Very long text here and centered}    \\     \hline \multicolumn{3}{c}{}                    \\     \hline Year &amp;   Cycle &amp; Issues     \\     \hline 2018-2019   &amp; High School &amp; very \\     \hline \end{tabularx}     \end{center} \end{document}
34471
What is wrong in the below trigger syntax, I am getting this error An unexpected token "INT" was found following " DECLARE NULL_ROW_ID".  Expected tokens may include:  "END-OF-STATEMENT".. SQLCODE=-104, SQLSTATE=42601, DRIVER=3.68.61  CREATE TABLE A (     A_ID INT NOT NUll,     A_CODE VARCHAR(100) NOT NULL,     PRIMARY KEY(A_ID) );  CREATE TABLE B (     B_ID INT NOT NUll,     B_CODE VARCHAR(100) NOT NULL,     A_ID INT,     PRIMARY KEY (B_ID),     FOREIGN KEY (A_ID) REFERENCES A (A_ID)  );  CREATE OR REPLACE TRIGGER B_TRIGGER AFTER UPDATE OF A_ID ON B REFERENCING NEW AS N OLD AS O FOR EACH ROW     WHEN (N.A_ID IS NULL)     BEGIN ATOMIC         DECLARE NULL_ROW_ID INT;         SET NULL_ROW_ID = (SELECT A_ID FROM A WHERE A_CODE = 'Custom Null String');         IF NULL_ROW_ID IS NULL THEN             SIGNAL SQLSTATE '70000' SET MESSAGE_TEXT = 'Custom Null String row not found.';         END IF;     SET N.A_ID = NULL_ROW_ID;     END @   It's on DB2 Express-C 10.5
3825
I am simply trying to return the rows from a table in my db but i keep getting this error thrown back at me no matter what I do "Fatal error: Unsupported operand types in C:\xampp\htdocs\d7\includes\form.inc on line 1009". Am I missing a argument or something?  This is my function  Hook menu  function auto_form_menu() { $items = array(); $items['admin/config/auto_form'] = array(     'title' =&gt; 'My Module',     'description' =&gt; 'description',     'page callback' =&gt; 'drupal_get_form',     'page arguments' =&gt; array('auto_form_records'),     'access arguments' =&gt; array('administer site configuration'),     'file' =&gt; 'auto_form.admin.inc' );  $items['admin/config/auto_form/manage'] = array(     'title' =&gt; 'My Module',     'type' =&gt; MENU_DEFAULT_LOCAL_TASK,     'description' =&gt; 'description',     'weight' =&gt; -10, ); return $items; }   'auto_form.admin.inc'  function auto_form_records() {   $header = array('First Name', 'Last Name');    $dbresult = db_query("SELECT first, last FROM {auto}");      $rows = array();     foreach ($dbresult as $dbrow) {         $rows[] = array(         $dbrow-&gt;first,         $dbrow-&gt;last       );     }     return $output = theme('table', array('header' =&gt; $header, 'rows' =&gt; $rows)); }   Updated Code:  Any help is appreciated seeing how I am completely lost on figuring this out.
41095
How do I create something like this without getting any errors?  \begin{thm}[\cite[page 10]{ABC2011}] ... \end{thm}   I tried putting various things into {...} brackets, but not eliminating any errors. I probably have misunderstood something about how LaTeX works in the background and the AMS packet:  \usepackage[amsmath,thmmarks]{ntheorem}
82615
On PHP 5.3.13/MySQL 5.5.21 the following code doesn't work:  if($check_custom_fields_form!=1){     $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." (                 `form_name` longtext NOT NULL,                 `field_id` bigint(20) NOT NULL,                 FOREIGN KEY (`field_id`) REFERENCES $table_custom_fields (`ID`) ON DELETE CASCADE ON UPDATE CASCADE     ) CHARACTER SET utf8 COLLATE utf8_general_ci";     dbDelta($sql); } if($check_subscribe_cat!=1){     $sql = "CREATE TABLE IF NOT EXISTS ". $table_subscribe_cat ." (                 `subscribe_id` bigint(20) NOT NULL,                 `cat_id` bigint(20) NOT NULL,                 FOREIGN KEY (`subscribe_id`) REFERENCES ".$wpdb-&gt;prefix."tgt_subscription (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,                 FOREIGN KEY (`cat_id`) REFERENCES ".$wpdb-&gt;prefix."terms (`term_id`) ON DELETE CASCADE ON UPDATE CASCADE     ) CHARACTER SET utf8 COLLATE utf8_general_ci";     dbDelta($sql);  }   The  suggested a downgrade to MySQL 5.1.37 (no, thanks) or the following update:  if($check_custom_fields_form!=1){         $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." (                     `form_name` longtext NOT NULL,                     `field_id` bigint(20) NOT NULL,                     KEY(field_id)         ) CHARACTER SET utf8 COLLATE utf8_general_ci";         dbDelta($sql);     } if($check_subscribe_cat!=1){       $sql = "CREATE TABLE IF NOT EXISTS ". $table_subscribe_cat ." (                   `subscribe_id` bigint(20) NOT NULL,                   `cat_id` bigint(20) NOT NULL,                   KEY(subscribe_id),                   KEY(cat_id)       ) CHARACTER SET utf8 COLLATE utf8_general_ci";       dbDelta($sql);    }   Which seems like a rather dirty way to work around the problem (no cascading deletes/updates). Therefore:   Do I really have to live with that ? Is it true that dbDelta only works with foreign key in a 3 year old MySQL version?
95938
I am trying to insert all values of one table into another. But the insert statement accepts values, but i would like it to accept a select * from the initial_Table. Is this possible?
17694
I can read the MySQL documentation and it's pretty clear. But, how does one decide which character set to use? On what data does collation have an effect?  I'm asking for an explanation of the two and how to choose them.
12526
Would you recommend using a  or a  field, and why (using MySQL)?   I'm working with PHP on the server side.
47794
I know the statement:  create table xyz_new as select * from xyz;   Which copies the structure and the data, but what if I just want the structure?
38016
I try to make a table for language manual. Could anybody help me to manage curly brackets in the cells of a table?  Like this:    I tried to do it like  but I could't manage it.
20304
I am trying to build a table inside a LaTeX 3 command. A MWE:  \documentclass{article} \usepackage{xparse}  \ExplSyntaxOn \NewDocumentCommand{\createTable}{ m m }{     \begin{tabular}{|c*{#2}{|c}|}         \hline         \int_step_inline:nnnn {1} {1} {#1} {             ##1             \int_step_inline:nnnn {1} {1} {#2} {                 &amp; x             }             \\\hline         }     \end{tabular} } \ExplSyntaxOff  \begin{document}      \createTable{5}{4}  \end{document}   This gives me following ouput in which the column lines of the first column are too long:    In order to solve this problem I read questions         Though I still did not understand the actual nature of the problem (or its given solutions), I was able to reproduce the solution from .  \documentclass{article} \usepackage{xparse}  \ExplSyntaxOn \DeclareDocumentCommand{\fillRow}{ m m }{     #1     \int_step_inline:nnnn {1} {1} {#2} {     &amp; x     }     \\\hline }  \DeclareDocumentCommand{\BuildTable}{ m }{     \begin{tabular}{|c*{#1}{|c}|}     \hline }  \def\endBuildTable{     \end{tabular} } \ExplSyntaxOff  \begin{document}      \begin{BuildTable}{4}         \fillRow{1}{4}         \fillRow{2}{4}         \fillRow{3}{4}         \fillRow{4}{4}         \fillRow{5}{4}     \end{BuildTable}  \end{document}   This code outputs the desired result. But I don't like it because it needs 3 commands instead of 1 (minor issue). But most of all because of the verbose, redundant and inflexible syntax to generate the table. Therefore I decided to make an abstraction by putting the table-generating-commands in another command:  \documentclass{article} \usepackage{xparse}  \ExplSyntaxOn \DeclareDocumentCommand{\fillRow}{ m m }{     #1     \int_step_inline:nnnn {1} {1} {#2} {     &amp; x     }     \\\hline }  \DeclareDocumentCommand{\BuildTable}{ m }{     \begin{tabular}{|c*{#1}{|c}|}     \hline }  \def\endBuildTable{     \end{tabular} }  \DeclareDocumentCommand{\putTogether}{ m m }{     \begin{BuildTable}{#2}         \int_step_inline:nnnn {1} {1} {#1} {             \fillRow{##1}{#2}         }     \end{BuildTable} } \ExplSyntaxOff  \begin{document}      \putTogether{5}{4}  \end{document}   But this brought me back to my original problem because the column lines of the first column are too long again.  Could anyone   explain to me what exactly is wrong with my original code; what the difference is between the second and the third code fragments; how to edit my (original) code in order to solve my problem?
4453
I don't have much experience with DB design, and having a hard time figuring out what's wrong with the following:   Table father has a composite PK (col1, col2) Table closure has ancestor(a-col1, a-col2), descendant(d-col1, d-col2) and length. Ancestor and Descendant are composite FKs, each pointing to the PK of father. The 4 columns (a-col1, a-col2,d-col1, d-col2) are a composite PK.   Look at the following fiddle:   I am working with MySQL.  I have constraints in CASCADE, but when I try to update the father table, the constraints give me errors. I can't do the following update to father table row:  UPDATE father  SET `col1` = "UPDATE_MY_ID_PLEASE"  WHERE `col1` = 'A' AND `col2` = 1;   Is the design wrong? How should this be done?