0% found this document useful (0 votes)
4 views1 page

Tutor Mysql Part 2 Gop

This document provides an overview of basic MySQL commands, including creating a database, using a database, and creating a table. It details the syntax for creating a database named 'mydb' and a table named 'mytable' with specific columns. Additionally, it explains the auto-increment feature for the 'id' column and includes examples of expected return values for each command.

Uploaded by

Irfan Pordjo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Tutor Mysql Part 2 Gop

This document provides an overview of basic MySQL commands, including creating a database, using a database, and creating a table. It details the syntax for creating a database named 'mydb' and a table named 'mytable' with specific columns. Additionally, it explains the auto-increment feature for the 'id' column and includes examples of expected return values for each command.

Uploaded by

Irfan Pordjo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Version Release Date

5.7 2015-10-01

Examples
Getting Started

Creating a database in MySQL

CREATE DATABASE mydb;

Return value:

Query OK, 1 row affected (0.05 sec)

Using the created database mydb

USE mydb;

Return value:

Database Changed

Creating a table in MySQL

CREATE TABLE mytable


(
id int unsigned NOT NULL auto_increment,
username varchar(100) NOT NULL,
email varchar(100) NOT NULL,
PRIMARY KEY (id)
);

CREATE TABLE mytable will create a new table called mytable.

id int unsigned NOT NULL auto_increment creates the id column, this type of field will assign a
unique numeric ID to each record in the table (meaning that no two rows can have the same id in
this case), MySQL will automatically assign a new, unique value to the record's id field (starting
with 1).

Return value:

Query OK, 0 rows affected (0.10 sec)

Inserting a row into a MySQL table

INSERT INTO mytable ( username, email )

https://riptutorial.com/ 3

You might also like