暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

mysql基础 select 查询表中的指定字段

  •        OS : Ubuntu 18.04.1 LTS
  •        DBMS : mysql 8.0.12

示例

stu@Ubuntu:~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 50 Server version: 8.0.12 MySQL Community Server - GPL Copyright (c) 2000, 2018, 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> use employees; 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> describe salaries; +-----------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------+------+-----+---------+-------+ | emp_no | int(11) | NO | PRI | NULL | | | salary | int(11) | NO | | NULL | | | from_date | date | NO | PRI | NULL | | | to_date | date | NO | | NULL | | +-----------+---------+------+-----+---------+-------+ 4 rows in set (0.00 sec) mysql> select * from salaries limit 0,10; +--------+--------+------------+------------+ | emp_no | salary | from_date | to_date | +--------+--------+------------+------------+ | 10009 | 60929 | 1985-02-18 | 1986-02-18 | | 10013 | 40000 | 1985-10-20 | 1986-10-20 | | 10048 | 40000 | 1985-02-24 | 1986-02-24 | | 10064 | 40000 | 1985-11-20 | 1986-11-20 | | 10070 | 55999 | 1985-10-14 | 1986-10-14 | | 10098 | 40000 | 1985-05-13 | 1986-05-13 | | 10126 | 40000 | 1985-09-08 | 1986-09-08 | | 10133 | 40000 | 1985-12-15 | 1986-12-15 | | 10137 | 40000 | 1985-02-18 | 1986-02-18 | | 10144 | 56720 | 1985-10-14 | 1986-10-14 | +--------+--------+------------+------------+ 10 rows in set (0.00 sec) mysql> select emp_no,salary from salaries limit 0,10; +--------+--------+ | emp_no | salary | +--------+--------+ | 10009 | 60929 | | 10013 | 40000 | | 10048 | 40000 | | 10064 | 40000 | | 10070 | 55999 | | 10098 | 40000 | | 10126 | 40000 | | 10133 | 40000 | | 10137 | 40000 | | 10144 | 56720 | +--------+--------+ 10 rows in set (0.00 sec) mysql> exit Bye stu@Ubuntu:~$

学习资源


欢迎各位同学一起来交流学习心得!

最后修改时间:2021-12-16 18:05:33
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论