mysql5.7基础 查询指定表中的所有数据

镇场文:
       学儒家经世致用,行佛家普度众生,修道家全生保真,悟易理象数通变。以科技光耀善法,成就一良心博客。
______________________________________________________________________________________________________

Operating System:UbuntuKylin 16.04 LTS 64bit
mysql: Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

登录:

[email protected]:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.17-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2016, 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 |
| myFirstDB          |
| mysql              |
| performance_schema |
| phpmyadmin         |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

mysql> use myFirstDB
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> show tables;#看看有哪些表
+---------------------+
| Tables_in_myFirstDB |
+---------------------+
| FirstTable          |
| PersonalInformation |
+---------------------+
2 rows in set (0.00 sec)

mysql> insert into PersonalInformation values(0,‘xinjinzhigang‘)
    -> ;      #向 PersonalInformation 表中 插入 符合规格的一行数据
Query OK, 1 row affected (0.07 sec)

查询指定表中的所有数据:

code:

mysql> select * from PersonalInformation;

result:

+------+---------------+
| nid  | name          |
+------+---------------+
|    0 | xinjinzhigang |
+------+---------------+
1 row in set (0.00 sec)

退出:

mysql> exit
Bye
[email protected]:~$

这里有个小问题,就是如何知道指定表的结构的呢?

______________________________________________________________________________________________________
若是您觉得此博文有可以改进的地方,请评论,我会仔细思考的。
注:此博文仅用于科研学习,如果侵犯到您的权益,请及时告知,我会做出相应的处理。

时间: 2024-08-09 22:01:58

mysql5.7基础 查询指定表中的所有数据的相关文章

C# ado.net基础 查询一个表中有多少行数据 在sqlsever中的一个表中

镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.------------------------------------------ 1 show my sql: 2 code first base .cs file 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using S

mysql5.7基础 向指定数据库的指定表中插入符合要求的数据

镇场文:       学儒家经世致用,行佛家普度众生,修道家全生保真,悟易理象数通变.以科技光耀善法,成就一良心博客.______________________________________________________________________________________________________ Operating System:UbuntuKylin 16.04 LTS 64bitmysql: Ver 14.14 Distrib 5.7.17, for Linux (

SqlSever基础 SUM 查询一个表中的一列的数值总和

镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ 1 table 2 code 1 --创建一个数据库 2 create database helloworld1 3 4 use master 5 drop database helloworld1 6 7 --用helloworld1这个数据库 8 use helloworld1 9 10 --

sql查询指定表外键约束

//////////////////查询指定表外键约束select a.name as 约束名, object_name(b.parent_object_id) as 外键表, d.name as 外键列, object_name(b.referenced_object_id) as 主健表, c.name as 主键列 from sys.foreign_keys A inner join sys.foreign_key_columns B on A.object_id=b.constraint

在 SQL Server 中查询EXCEL 表中的数据遇到的各种问题

原文:在 SQL Server 中查询EXCEL 表中的数据遇到的各种问题 SELECT * FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source="D:\KK.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...[Sheet1$] 问题: 消息 15281,级别 16,状态 1,第 1 行 SQL Server 阻止了对组件 'Ad Hoc Di

5:查询两表中的所有字段,满足性别为‘男’的记录(使用语句块)

5:查询两表中的所有字段,满足性别为'男'的记录 1.先创建表t_code_sex 2.创建表t_employee 3.编辑数据 4.执行pl/sql语句块 ---pl/sql语句块查询满足性别为男的 declare type t_employee_record_type is record( v_empid t_employee.emp_id%type, v_emp_name t_employee.emp_name%type, v_sex_name t_code_sex.name%type);

oracle查询包含在子表中的主表数据

Oracle数据库,查询某表中包含在子表中的数据,子表中数据按特定条件来源于该父表,SQL命令如 select * from a_table a where a.commandId in (select commandId from b_table where type = 1) a_table父表,b_table子表,a和b表都有commandId列,a表的commandId主键关联b表中的外键commandId,要求a表中commandId包含在b表commandId中,且b表的type黑白

MySQL 处理重复数据:防止表中出现重复数据、统计、过滤、删除重复数据

MySQL 处理重复数据 有些 MySQL 数据表中可能存在重复的记录,有些情况我们允许重复数据的存在,但有时候我们也需要删除这些重复的数据. 本章节我们将为大家介绍如何防止数据表出现重复数据及如何删除数据表中的重复数据. 防止表中出现重复数据 你可以在 MySQL 数据表中设置指定的字段为 PRIMARY KEY(主键) 或者 UNIQUE(唯一) 索引来保证数据的唯一性. 让我们尝试一个实例:下表中无索引及主键,所以该表允许出现多条重复记录. CREATE TABLE person_tbl

定位表中的行数据存放于哪一个具体的datafile上

副标题:用一个PL/SQL查出表中的行数据存放在哪个具体的datafile中 经常有遇到做DBA的朋友问,该如何知道自己插入的某一行数据,是存在了数据库中的哪一个数据文件(datafile)上了,回答是肯定可以的.在此,就将该方法写出来供更多的朋友使用. 1.正常查询步骤 1.1.先查到表上行数据的ROWID select rowid from tivoli.test_db_avg1 where rownum =1 输出值:   AAAQ0mAAEAAAAhLAAA 1.2.根据ROWID定位到