Last active
August 22, 2016 13:08
-
-
Save pphamnham/017ddc6f4a6c257a8de73b9fc1fccdbd to your computer and use it in GitHub Desktop.
Revisions
-
pphamnham revised this gist
Aug 22, 2016 . 1 changed file with 23 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,33 @@ #SQL #GENERAL CONCEPT ### SELECT THE EXISTING DATABASE ```USE name_database; ``` ###DISPLAY EXISTING TABLES ```SHOW TABLES; ``` ###CREATE NEW TABLE ```ruby CREATE TABLE students( id INT NOT NULL PRIMARY KEY, name VARCHAR(40) NOT NULL, class VARCHAR(20), age INT); ``` **Using AutoIncrement to make sure the key automatically update** ``` CREATE TABLE subjects ( subjectid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, title VARCHAR(50) NOT NULL ); ``` ###DESCRIBE STRUCTURE OF THE TABLE ```DESCRIBE students``` ###DELETE ```DROP TABLE students``` ###ADD DATA ```ruby INSERT INTO students VALUES (XX,XX,XX) INSERT INTO students(id, firstname, lastname) VALUES (xx,xx,xx); ``` -
pphamnham created this gist
Aug 22, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #SQL ## SELECT THE EXISTING DATABASE ```USE name_database; ``` ##DISPLAY EXISTING TABLES ```SHOW TABLES; ``` ##CREATE NEW TABLE ```ruby CREATE TABLE students( id INT NOT NULL PRIMARY KEY, name VARCHAR(40) NOT NULL, class VARCHAR(20), age INT); ```