This Is Your Brain On Informatics: MariaDB: Difference between revisions

Tikenn (talk | contribs)
No edit summary
Tikenn (talk | contribs)
No edit summary
Line 10: Line 10:
|- align = "center"
|- align = "center"
! colspan = "3" | Common Commands in SQL
! colspan = "3" | Common Commands in SQL
|- align = "center"
! colspan ="3" | Boolean Operators
|- align = "center"
| colspan ="3"  | AND
|- align = "center"
| colspan ="3" | OR
|- align = "center"
| colspan ="3" | NOT
|-
|-
! Command* !! Syntax !! Description
! Command* !! Syntax !! Description
Line 23: Line 31:
| WHERE || || Limits the available values SELECT can pull from each column based on a logical statement (e.g. WHERE ''col1'' < 10)
| WHERE || || Limits the available values SELECT can pull from each column based on a logical statement (e.g. WHERE ''col1'' < 10)
|-
|-
| AS ''vaR'' || || Sets an output to a variable  
| AS ''var'' || || Sets an output to a variable  
|- align = "center"
! colspan ="3" | Boolean Operators
|- align = "center"
| colspan ="3"  | AND
|- align = "center"
| colspan ="3" | OR
|- align = "center"
| colspan ="3" | NOT
|-
|-
| CREATE TABLE `[table]` || Creates a table of the given name with the properly input variable (see below)
| CREATE TABLE `[table]` || Creates a table of the given name with the properly input variable (see below)
Line 61: Line 61:
| CREATE TEMPORARY TABLE `[table]` || || Creates a temporary table of the given name
| CREATE TEMPORARY TABLE `[table]` || || Creates a temporary table of the given name
|-
|-
| INSERT INTO || 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 || Inserts new data entries into the specified columns
| INSERT || 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 || Used with INTO to insert new data entries into the specified columns
|-
| INTO || SELECT * or ''column_name(s)''<br />INTO ''newtable'' [IN ''externaldb'']<br />FROM ''table1'';|| Used with SELECT command to copy ''column_names'' from ''table1'' into ''newtable''
|-
| UPDATE || UPDATE ''table_name''<br />SET ''column1=value1,column2=value2,...''<br />WHERE ''some_column''=''some_value;'' || Changes ''column1'' to ''value1'' based on the WHERE statement (use something unique to update only one row)
|-
|-
| SELECT INTO || SELECT * or ''column_name(s)''<br />INTO ''newtable'' [IN ''externaldb'']<br />FROM ''table1'';|| Copies ''column_names'' from ''table1'' into ''newtable''
|}
|}