SQL-Boolean and Relational Operators

AI权益加码!Claude Code、Cursor等20+工具免费用! 购周边限时加赠Coding Plan Lite,畅享主流AI工具!学习进阶更高效! 阅读详情
  1. Write a query to display all customers with a grade above 100.
    SELECT * FROM customer WHERE grade>100;
  2. Write a query statement to display all customers in New York who have a grade value above 100.
    SELECT *
    FROM customer
    WHERE city='New York'
    AND grade>100;
    
  3. Write a SQL statement to display all customers, who are either belongs to the city New York or had a grade above 100.
    SELECT *
    FROM customer
    WHERE city='New York'
    OR grade>100;
    
  4. Write a SQL statement to display all the customers, who are either belongs to the city New York or not had a grade above 100.
    SELECT *
    FROM customer
    WHERE city='New York'
    OR grade<=100;
    ------
    SELECT *
    FROM customer
    WHERE city='New York'
    OR NOT grade>100
    
  5. Write a SQL query to display those customers who are neither belongs to the city New York nor grade value is more than 100.
    SELECT *
    FROM customer
    WHERE NOT (city='New York' OR grade>100)
    
  6. Write a SQL statement to display either those orders which are not issued on date 2012-09-10 and issued by the salesman whose ID is 505 and below or those orders which purchase amount is 1000.00 and below.
    SELECT *
    FROM orders
    WHERE NOT (
    (ord_date='2012-09-10' AND salesman_id>505)
    OR purch_amt<=1000.00);
    
  7. Write a SQL statement to display salesman_id, name, city and commission who gets the commission within the range more than 0.10% and less than 0.12%.
    SELECT *
    FROM salesman
    WHERE commission BETWEEN 0.10 AND 0.12;
    
  8. Write a SQL query to display all orders where purchase amount less than 200 or exclude those orders which order date is on or greater than 10th Feb,2012 and customer id is below 3009.
    SELECT *
    FROM orders
    WHERE purch_amt<=200
    OR NOT 
    (ord_no>='2012-02-10' AND customer_id<3009);
    
  9. Write a SQL statement where i) order dates are anything but 2012-08-17, or customer id is not greater than 3005 ii) and purchase amount is not below 1000.
    ?题目理解存在问题
    SELECT *
    FROM orders
    WHERE (ord_date!=‘2012-08-17’ OR customer_id<=3005)
    AND purch_amt>=1000;
    ------ 标准答案
    SELECT * 
    FROM  orders 
    WHERE NOT((ord_date ='2012-08-17' 
    OR customer_id>3005) 
    AND purch_amt<1000);
    
  10. Write a SQL query to display order number, purchase amount, achieved, the unachieved percentage for those order which exceeds the 50% of the target value of 6000.
  • 在使用as设立别名时,需要使用双引号
    SELECT ord_no, purch_amt,
    purch_amt/6000*100 as "achieved %",
    (6000-purch_amt)/6000*100 as "unachieved %"
    FROM orders
    WHERE purch_amt>0.5*6000
    
  1. Write a query in SQL to find the data of employees whose last name is Dosni or Mardy.
    SELECT *
    FROM emp_details
    WHERE EMP_LNAME IN ('Dosni', 'Mardy');
    
  2. Write a query in SQL to display all the data of employees that work in department 47 or department 63.
    SELECT *
    FROM emp_details
    WHERE EMP_DEPT IN (47, 63);
    

来源:w3resource

MyBatis-Plus实战指南:从CRUD封装到数据权限的进阶应用 在Java企业级开发中,ORM框架是连接应用与数据库的核心组件,它通过对象关系映射简化了数据操作。MyBatis作为一款半自动化的ORM框架,提供了灵活的SQL编写能力,但在处理大量基础CRUD操作时,开发者仍需编写重复的模板代码。MyBatis-Plus(MP)作为MyBatis的增强工具,通过封装通用Mapper、提供类型安全的查询构造器以及内置分页插件,极大地提升了开发效率。其核心价值在于将开发者从繁琐的SQL编写中解放出来,专注于复杂业务逻辑的实现。在应用场景上,MP不仅适用于快速构建后台管理系统, 阅读详情

相关推荐

SQL-Aggregate Functions

Write a SQL statement to find the total purchase amount of all orders.SELECT SUM(purch_amt) FROM orders; Write a SQL statement to find the average purchase amount of all orders.SELECT AVG(purch_amt...

xingyu的博客 745

The Relational View of Data

Laying Plans:Desinging Databases for Performance 在所有战争中,显示军事才华的第一步是战略规划。——Joseph de Msistre(1754-1821) The Relational View of Data 关系理论的关键原理是:关系不包含重复数据,且记录之间没有顺序。 建模是业务需求(business re

~~~~~........... 471

【信息科学与工程学】【数据中心】 第十五篇 智算中心DaaS数据消费场景02

智算中心DaaS数据共享场景的分级分类是一个复杂的系统工程,需要从技术、安全、合规、治理、运营等多个维度进行综合考虑。本分级分类体系为不同场景下的数据共享提供了详细的指导,包括安全分级、共享模式、技术架构、合规治理等方面。在实施数据共享平台时,应结合自身业务需求、技术能力和资源情况,选择适合的共享模式和实施路径。同时,要高度重视数据安全和隐私保护,采用先进的技术和管理手段,确保数据共享的安全可控。

weixin_49199313的博客 1万+

数据库SQL(七):Relational Algebra(关系代数)

从本篇文章内容开始,逐渐深入探究高级数据库知识,内容难度有显著提升,我努力用最清楚的方式解释,量力而行。 文章目录IntroductionSelect OperationProject OperationUnion OperationSet Difference OperationCartesian-Product Operation Introduction 关系代数的基本运算:union, intersection, selection, projection, Cartesian product 和r

IamCerian的博客 7545

若依框架 RuoYi-Vue 3.8.9 多租户隔离实战:从零到生产的完整改造指南

本文基于 RuoYi-Vue 3.8.9 原版框架(非Plus版本),分享了行级多租户隔离的完整生产级改造方案。目标是让多个租户共享同一套系统实例,但数据相互隔离。

kwb18293575696的博客 504

哈佛 CS50 中文官方笔记(三)

在本课中,你学习了如何使用指针构建新的数据结构。具体来说,我们深入探讨了…数据结构栈和队列调整数组大小链表字典Tries次次见!在本节课中,你学习了如何将之前课程中编程的基本构建块在 Python 中实现。此外,你还了解了 Python 如何使代码更加简化。同时,你学习了如何利用各种 Python 库。最后,你了解到作为一名程序员,你的技能并不仅限于单一编程语言。你已经看到,通过这门课程,你正在发现一种新的学习方法,这可以在任何编程语言中为你服务——也许在几乎任何学习领域中都能!

龙哥盟 187

SQL-retrieve data from tables

Retrieve data from tables Write a SQL statement to display all the information of all salesmen. SELECT * FROM salesman; Write a SQL statement to display a string “This is SQL Exercise, Practice and S...

xingyu的博客 8993

SQL-Formatting Output

Write a SQL statement to display the commission with the percent sign ( % ) with salesman ID, name and city columns for all the salesmen. 疑问:题目的意思应该是,输出数据时将commission的值转化为百分比值 网站给出的标准答案并没有实现此功能 ---...

xingyu的博客 543

SQL-Query on Multiple Tables

Write a query to find those customers with their name and those salesmen with their name and city who lives in the same city.SELECT customer.cust_name, salesman.name, customer.city FROM customer JOIN...

xingyu的博客 513

SQL-Wildcard and Special operators

下划线_: 通配符/占位符,匹配单个字符 ESCAPE:需要查询特殊字符时,使用ESCAPE进行转义 语法:WHERE ColumnA LIKE ‘%5/%%’ ESCAPE ‘/’ Write a SQL statement to find those salesmen with all information who come from the city either...

xingyu的博客 484

10kV变电所标准图.pdf.rar

10kV变电所标准图.pdf.rar

35kV屋内配电装置接线图.dwg.rar

35kV屋内配电装置接线图.dwg.rar

校园招聘基于Python的智能匹配平台设计:多角色权限管理与岗位推荐系统实现 项目介绍 基于Python的校园招聘平台设计与实现(含模型描述及部分示例代码)

内容概要:本文详细介绍了一个基于Python的校园招聘平台的设计与实现,旨在通过信息化手段提升校园招聘的效率与精准度。平台采用Python主流框架(如Django/Flask)构建,涵盖用户权限管理、招聘与简历数据建模、智能匹配推荐、日志监控与统计分析等核心模块。系统支持学生、企业、就业部门等多角色协同,通过结构化数据模型和业务流程控制,实现了岗位发布、简历投递、状态流转、权限校验等功能,并结合TF-IDF与余弦相似度算法实现简历与岗位的智能匹配。代码示例展示了用户角色模型、企业岗位模型、简历分表设计、投递状态机、权限装饰器及推荐服务等关键实现,体现了系统的可扩展性与安全性设计。; 适合人群:具备Python Web开发基础,熟悉Django或Flask框架,有一定数据库设计和前后端交互经验的开发者,尤其是从事教育信息化、招聘系统开发或校园服务平台建设的研发人员;也适合计算机相关专业高年级本科生或研究生作为毕业设计参考。; 使用场景及目标:① 构建高校内部统一的校园招聘管理系统,替代传统低效的线下招聘模式;② 实现学生与企业岗位的智能匹配与个性化推荐,提升人岗匹配效率;③ 为企业和高校就业部门提供数据驱动的招聘分析与决策支持;④ 学习多角色权限控制、状态机设计、ORM建模、缓存与异步任务等实际开发技巧。; 阅读建议:此资源以实际项目为导向,不仅提供完整模型设计与代码片段,还深入剖析了系统架构与业务逻辑。建议读者结合代码示例搭建本地开发环境,动手实践模型定义、API接口开发与推荐算法集成,并重点关注权限控制、数据安全与性能优化等关键设计,以全面提升全栈开发与系统设计能力。

技术转移机构如何提升成果转化效率?.docx

技术转移机构如何提升成果转化效率?

IEC_60204-1-2021 CSV 机械电气设备 第 1 部分:通用技术条件 合并版

IEC_60204-1-2021 CSV 机械电气设备 第 1 部分:通用技术条件 中英两册

EF_6403.rar

EF_6403.rar

Casio说明书5174

Casio说明书5174

上一篇: SQL-retrieve data from tables
下一篇: SQL-Wildcard and Special operators
snistty
博客等级 码龄10年 1粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值