Changes

Jump to: navigation, search

This Is Your Brain On Informatics: MariaDB SQL Commands

231 bytes added, 04:43, 12 April 2014
no edit summary
== MariaDB SQL Commands ==
The language of Maria DBNote that the commands are capitalized by convention.
{| class = "wikitable"
| style="padding: 10px" | Assigns a character variable (allows ONLY 1 character)
|-
| style="padding: 10px" | CREATE TABLE `''table''`| style="padding: 10px" | CREATE TABLE `''table''` (<br />`''column_name1''` ''DATA_TYPE'',<br />`''column_name2''` ''DATA_TYPE'',<br />''etc.''<br />);
| style="padding: 10px" | Creates a table of the given name with the properly input variable (see below)
|-
| style="padding: 10px" | CREATE TEMPORARY TABLE `[table]`| style="padding: 10px" | CREATE TEMPORARY TABLE `''table''` (<br />`''column_name1''` ''DATA_TYPE'',<br />`''column_name2''` ''DATA_TYPE'',<br />''etc.''<br />);
| style="padding: 10px" | Creates a temporary table of the given name
|-
|-
| style="padding: 10px" | FROM
| style="padding: 10px" | FROM `''table''`
| style="padding: 10px" | Denotes which table SELECT pulls the columns from (e.g. SELECT [col1],[col2] FROM `''table''`
|-
| style="padding: 10px" | INSERT
| style="padding: 10px" | INSERT INTO ''table_name''<br /><br />VALUES (''value1,value2,value3,...'');<br /><br />INSERT INTO ''table_name'' (''column1,column2,column3,...'')<br /><br />VALUES (''value1,value2,value3,...''); -- specifies the columns the values go into
| style="padding: 10px" | Used with INTO to insert new data entries into the specified columns
|-
|-
| style="padding: 10px" | INTO
| style="padding: 10px" | SELECT * or ''column_name(s)''<br />INTO ''newtable'' [IN ''externaldb'']<br />FROM ''table1'';
| style="padding: 10px" | Used with SELECT command to copy ''column_names'' from ''table1'' into ''newtable''
|-
|-
| style="padding: 10px" | UPDATE
| style="padding: 10px" | UPDATE ''table_name''<br />SET ''column1=value1,column2=value2,...''<br />WHERE ''some_column''=''some_value;''
| style="padding: 10px" | Changes ''column1'' to ''value1'' based on the WHERE statement (use something unique to update only one row)
|-
|-
|}
 
*Commands are capitalized by convention.
347
edits

Navigation menu