sql - SQL 查询 GROUP BY 在通过 Google Chome 访问的 w3 学校网站上未按预期工作,通过 Firefox 按预期工作
问题描述
我尝试从 w3schools.com 上的 ubuntu 18.04 机器上运行以下查询“自己尝试”SQL 控制台从两个不同的浏览器 -
1. Google Chrome(版本 81.0.4044.122(官方构建)(64 位))
2. Firefox(版本 75.0(64 位))。
SELECT City, Country
FROM Customers
GROUP BY Country;
此查询在运行时不应该工作,在 firefox 上也观察到了同样的情况。
Result on w3schools in Firefox
Error in SQL:
You tried to execute a query that does not include the specified expression 'City' as part of an aggregate function.
但是,当在 Google Chrome 中执行相同的查询时,会得到以下结果。
Number of Records: 21
City Country
Buenos Aires Argentina
Graz Austria
Bruxelles Belgium
São Paulo Brazil
Tsawassen Canada
København Denmark
Oulu Finland
Strasbourg France
Berlin Germany
Cork Ireland
Torino Italy
México D.F. Mexico
Stavern Norway
Walla Poland
Lisboa Portugal
Madrid Spain
Luleå Sweden
Bern Switzerland
London UK
Eugene USA
Caracas Venezuela
当通过 Google Chrome 在 w3school.com 上运行查询时,我不明白在后台发生了什么。
自己试试:https ://www.w3schools.com/sql/trysql.asp?filename=trysql_select_groupby
解决方案
w3schools 的 JavaScript 实际上是对 SQLite 数据库执行这些操作。当您加载页面时,脚本w3Database.js正在初始化数据库。FireFox 中 SQLite 的实现与 Chrome 中的实现略有不同。这就是为什么你会看到这种差异。
随时报告 Chrome 的错误。
推荐阅读
- powershell - Active Directory Powershell 在脚本内部的访问权限不足,但能够从命令行运行命令
- amazon-web-services - 计算应更新 Lambda 层的时间
- react-native - React Native 中的六边形图像
- bash - 在每个组之前从第一列添加唯一值
- assembly - MIPS 问题。如何摆脱某些字符
- sql - SQL 搜索带撇号的结果
- r - 在 r 中的地理加权回归中获得新点的预测
- listview - Listview 拉起按钮/小部件
- python - 从 Google 存储桶下载对象需要哪些角色
- node.js - 通过 REST API 进行批量数据传输