Creating Tables From Command Prompt

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Creating Tables from Command Prompt

mysql> CREATE TABLE tutorials_tbl(


-> tutorial_id INT NOT NULL AUTO_INCREMENT,
-> tutorial_title VARCHAR(100) NOT NULL,
-> tutorial_author VARCHAR(40) NOT NULL,
-> submission_date DATE,
-> PRIMARY KEY ( tutorial_id )
-> );

Dropping Tables from the Command Prompt


mysql> DROP TABLE tutorials_tbl;

Inserting Data from the Command Prompt


mysql> INSERT INTO tutorials_tbl
->(tutorial_title, tutorial_author, submission_date)
->VALUES
->("Learn PHP", "John Poul", NOW());

Fetching Data from a Command Prompt


mysql> SELECT * from tutorials_tbl
mysql> SELECT * from tutorials_tbl WHERE
tutorial_author = 'Sanjay';

Updating Data from the Command Prompt


mysql> UPDATE tutorials_tbl
-> SET tutorial_title = 'Learning JAVA'
-> WHERE tutorial_id = 3;

You might also like