1. 程式人生 > >mysql8基礎 聚合函式 sum 求和

mysql8基礎 聚合函式 sum 求和

資料,資料,命根就在資料 ! 操作資料庫時,一定要謹慎小心。師萬物 的程式碼看看就好,要有自己的判斷。遇到抉擇,要不恥上下問。

example

stu@Ubuntu:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 40
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 sum(salary) from salaries; +--------------+ | sum(salary) | +--------------+ | 181480757419 | +--------------+ 1 row in set (0.64 sec) mysql> exit Bye stu@Ubuntu:~$

resource

MySQL是一個關係型資料庫管理系統,目前是開源的(2018-10)。
許可權明確,引擎與字符集等選擇恰當,命名規範。
MariaDB,Redis,MongoDB,PostgreSQL,Hive,HBase等,多作了解,拓寬心量。
Workbench,phpMyAdmin,Navicat等圖形化管理工具,豫兮若冬涉川。