select id,age as '年龄',high, gender from students; -- 通过表名字段查询 select students.id,students.name from students; -- 给表起别名查询 select s.id,s.name,s.age from students as s; --消除重复行 -- distinct select distinct high from students; 条件查询 --比较运算符 -- 查询年纪...
select count(stuid) as NO,classid from students group by classid; select count(stuid) as NO,classid from students group by classid having NO>2; select name,age from students order by age limit 10,10; (第一个表示偏移10个,第二个表示取10个) 多表查询: 交叉连接:笛卡尔乘积(最消耗资源的...
8、查看表格中的数据:这里我们就以刚才的案例为例,查看一下刚才在“userInfo”数据库中插入的数据。这里我们要用到“select”命令,如图8所示 图8 9、修改数据:还是拿刚才的案例来演示,我们把那么字段值“jacky”换成“jackie”。这里我们要用到“update”命令,具体命令为“update userInfo set name ='jackie' whe...
mariadb(端口号为3306): (进入数据库的命令) mysql -u root -p 密码: 指定进入的表 mysql -u root -p+密码 表名创建数据库 create database 库名;查看所有的库 create databases;使用数据库 use 库名;查看库里的表 show tables;根据信息来查看表的内容 select +(关键词) from 表名;要想查看全 ...
我们将通过执行SELECT语句来执行此操作,如下所示: SELECT * FROM books; +---+---+---+---+ | BookID | Title | SeriesID | AuthorID | +---+---+---+---+ | 1 | The Fellowship of the Ring | 1 | 1 | | 2 | The Two Towers | 1 | 1 | | 3 | The Return of the King |...
MariaDB [(数据库名)]> select 列名1,列名2,... from 表名; MariaDB [(none)]> select user,host,password from mysql.user; +---+---+---+ | user | host | password | +---+---+---+ | root | localhost | | | root | t1 | | | root | 127.0.0.1 | | | root | ::1 | ...
select执行流程 1 FROM --> WHERE --> GROUP BY --> HAVING --> ORDER BY --> SELECT --> LIMIT 连接查询 事先将两张或多张表执行相应的join操作,而后根据join结果做查询 1 2 3 4 5 6 7 8 9 10 11 12 13 14 CROSS JOIN:笛卡尔积,交叉连接 ...
MariaDB[(none)]>REVOKESELECT(host,user)ONmysql.userFROM'userid'@'%';QueryOK,0rowsaffected(0.000sec) 4.2、删除用户 DROP USER [用户名]@[IP]; 代码语言:javascript 代码运行次数:0 运行 AI代码解释 MariaDB[(none)]>DROPUSERIFEXISTS'userid'@'%';QueryOK,0rowsaffected(0.000sec) ...
MariaDB 第3集 多表联查。一、多表关联查询语句温馨提示1、 多表查询若不过滤结果,则得到两表的乘积,叫做笛卡尔乘积。非交集部分不显示)二、空值查询1. select * from 表 where age= 没有值 或为02. select * from 表 where age=null值为null3. sele...
SELECT column1, column2, … FROM table_name WHERE condition; “` 以上是一些常用的Linux MariaDB命令,它们可以帮助你在Linux系统中管理和操作MariaDB数据库。 在Linux系统中,使用MaraiDB数据库管理系统时可以使用以下常用的命令: 1. 登录MariaDB数据库:可以使用以下命令登录到MariaDB数据库服务器: ...