热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

模拟考试

设为首页

收藏此页面

订阅邮箱地址

SQL Query 面试题与答案

问题 36. What is the difference between UNION and UNION ALL?

UNION combines and returns unique rows from multiple SELECT statements, while UNION ALL returns all rows including duplicates.

Example:

SELECT column1 FROM table1 UNION SELECT column1 FROM table2;

这有帮助吗? 添加评论 查看评论
 

问题 37. Write a SQL query to find the average salary of employees in each department, excluding departments with fewer than five employees.

SELECT department, AVG(salary) FROM Employee GROUP BY department HAVING COUNT(*) >= 5;

这有帮助吗? 添加评论 查看评论
 

问题 38. Explain the purpose of the SQL INDEX.

An INDEX is a performance optimization feature that allows faster retrieval of records from a table. It is created on one or more columns of a table.

Example:

CREATE INDEX index_name ON table(column);

这有帮助吗? 添加评论 查看评论
 

问题 39. What is a self-referencing foreign key?

A self-referencing foreign key is a foreign key in a table that references the primary key of the same table, creating a relationship within the same table.

这有帮助吗? 添加评论 查看评论
 

问题 40. Write a SQL query to find the total salary expense for each department.

SELECT department, SUM(salary) FROM Employee GROUP BY department;

这有帮助吗? 添加评论 查看评论
 

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。