我创建了一个名为 simpleWeb 的 node.js 项目。该项目包含 package.json 和 index.js。
索引.js
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('How are you doing');
});
app.listen(8080, () => {
console.log('Listening on port 8080');
});
Run Code Online (Sandbox Code Playgroud)
包.json
{
"dependencies": {
"express": "*"
},
"scripts": {
"start": "node index.js"
}
}
Run Code Online (Sandbox Code Playgroud)
我还创建了一个 Dockerfile 来为我的 node.js 项目创建 docker 镜像。
文件
# Specify a base image
FROM node:alpine
# Install some dependencies
COPY ./ ./
RUN npm install
# Default command
CMD ["npm", …
Run Code Online (Sandbox Code Playgroud) 假设我们有两个表:1.学生2.系
Student table has 4 columns
1. id (int pk)
2. name (varchar)
3. percentage (int)
4. dept_id (fk)
Department table has 3 columns
1. dept_id (int pk)
2. dept_name (varchar)
Run Code Online (Sandbox Code Playgroud)
查询是从每个部门中选择比例最高的前3名学生。
我已经用row_num()函数编写了查询。
但是,当有相同百分比的学生时,我面临问题。
Student table with:
id name percentage dept_id
1 a 70 1
2 b 80 1
3 c 90 1
4 d 70 1
5 e 55 1
6 f 50 2
7 g 65 2
8 h 68 2
Department table with
dept_id dept_name
1 Information …
Run Code Online (Sandbox Code Playgroud)