Created
August 9, 2016 09:15
-
-
Save theWhiteFox/756846a4aabde745a2bbfaee4097e410 to your computer and use it in GitHub Desktop.
SQL commands
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 characters
| -- login to my local MySql server | |
| mysql -u root -p | |
| -- password: | |
| SHOW databases; | |
| CREATE DATABASE db_name; | |
| USE db_name; | |
| SHOW tables; | |
| CREATE TABLE table_name ( | |
| id int(10) NOT NULL AUTO_INCREMENT, | |
| foreign_key_id int(10), | |
| name varchar(255), | |
| date timestamp, | |
| PRIMARY KEY(id), | |
| FOREIGN KEY(foreign_key_id) REFERENCES table_name(foreign_key_id) | |
| ); | |
| RENAME TABLE `memebers` TO `members` | |
| UPDATE `books` SET `author`='Luke Wroblewski', `title`='Mobile First', `link`='http://www.abookapart.com/products/mobile-first', `image`='images/mobile_first.jpg' WHERE `book_id`=2; | |
| create table posts(post_id INT AUTO_INCREMENT, title varchar(255), body text, PRIMARY KEY(post_id)); | |
| describe posts | |
| INSERT INTO posts (title, body) VALUES('PHP is\'t too hard', 'Here is the body of the second post'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment