Technology Innovation - Blog para Programadores Esta é uma ideia que surgiu para divulgar as possíveis soluções que possam facilitar a vida aos programadores
segunda-feira, julho 25, 2016
How to use mySQL (create database, use database, create table, see column table) and commands
Commands list:
http://g2pc1.bu.edu/~qzpeng/manual/MySQL%20Commands.htm
Sample:
Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.1.73-community MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
mysql> create database sysformatdb;
Query OK, 1 row affected (0.02 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| sysformatdb |
+--------------------+
3 rows in set (0.00 sec)
mysql> use sysformatdb
Database changed
mysql> CREATE TABLE employees (firstname VARCHAR(20), middleinitial VARCHAR(3),
lastname VARCHAR(35),suffix VARCHAR(3), officeid VARCHAR(10),userid VARCHAR(15),
username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),date
stamp DATE,timestamp time,pgpemail VARCHAR(255));
Query OK, 0 rows affected (0.08 sec)
mysql> show tables;
+-----------------------+
| Tables_in_sysformatdb |
+-----------------------+
| employees |
+-----------------------+
1 row in set (0.00 sec)
mysql> show columns from employees;
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| firstname | varchar(20) | YES | | NULL | |
| middleinitial | varchar(3) | YES | | NULL | |
| lastname | varchar(35) | YES | | NULL | |
| suffix | varchar(3) | YES | | NULL | |
| officeid | varchar(10) | YES | | NULL | |
| userid | varchar(15) | YES | | NULL | |
| username | varchar(8) | YES | | NULL | |
| email | varchar(35) | YES | | NULL | |
| phone | varchar(25) | YES | | NULL | |
| groups | varchar(15) | YES | | NULL | |
| datestamp | date | YES | | NULL | |
| timestamp | time | YES | | NULL | |
| pgpemail | varchar(255) | YES | | NULL | |
+---------------+--------------+------+-----+---------+-------+
13 rows in set (0.00 sec)
mysql>
Subscrever:
Enviar feedback (Atom)
Sem comentários:
Enviar um comentário