我有一个查询,我必须找到GPA高于3.5的那个学生的名字和姓氏。可以按照以下步骤进行操作:
select first name, last name
from Students
where GPA > 3.5;
但是我需要创建一个新的标题列“ name”,其中将名字和姓氏(两者之间有一个空格)结合在一起。如何创建新的标题字段?
答案 0 :(得分:1)
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const logger = require('morgan');
const cors = require('cors');
const passport = require('passport');
const errorMiddleware = require('./middleware/error');
const config = require('./config');
const uploadRoutes = require('./routes/upload');
// initialize the app
const app = express();
// middleware
app.use(cors('http://localhost:4200/'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
// static folder
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, '/angular-src/src/assets/img')));
app.use(`${config.root}/upload`, uploadRoutes);
module.exports = app;
或
select concat(`first name`, " ", `last name`) as name
from Students
where GPA > 3.5;
答案 1 :(得分:1)
示例:
USE AdventureWorks2012
Select FirstName,LastName,(FirstName+' '+ LastName) As [Name] from Person.Person
或
Select FirstName,LastName,concat(firstname,' ', lastname) as name
from Person.Person
您将获得相同的结果
回到查询
Select first name, last name ,(FirstName+' '+ LastName) As [Name]
From Students
Where GPA > 3.5;