随笔分类 - SQL
摘要:一道简单的sql语句题
阅读全文
摘要:627.Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice
阅读全文
摘要:留存分析——左连接 矩阵分析——group by 结构分析:分析每种产品占据总销售量的比例 排序分析
阅读全文
摘要:http://www.cda.cn/view/21469.html tb_lemon_grade中,表中字段id,student_name,course,score分别表示成绩id,学生姓名,课程名称,课程成绩,表中数据表1所示。请写出一条SQL,将表1的数据变成表2的形式id 学生姓名 课程名称
阅读全文
摘要:学习笔记,原文来自http://blog.csdn.net/robinjwong/article/details/24845125 创建分组 - GROUP BY 分组是在SELECT语句的GROUP BY子句中建立的。它的作用是通过一定的规则将一个数据集划分成若干个小的区域,然后针对若干个小区域进
阅读全文
摘要:W3Schools SQL Quiz 1. What does SQL stand for? You answered: Correct Answer! 2. Which SQL statement is used to extract data from a database? You answe
阅读全文
摘要:181. Employees Earning More Than Their Managers https://leetcode.com/problems/employees-earning-more-than-their-managers/#/description The Employee ta
阅读全文
摘要:题目说明及要求: 以下是模似数据库里的表单信息,请根据要求写出SQL语句 表1:职工信息 表结构如下: 表名:Employee 职工ID 职工姓名 入职年份 部门ID A1 B1 2000 C1 A2 B2 1998 C2 A3 B3 1999 C1 A4 B4 2001 C4 表2:部门信息 表结
阅读全文
摘要:196. Delete Duplicate Emails Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its
阅读全文
摘要:181. Employees Earning More Than Their Managers The Employee table holds all employees including their managers. Every employee has an Id, and there i
阅读全文
摘要:《SQL学习指南》第9章 子查询 参考:leetcode 2 —————————————————————— 9.1 啥是子查询 9.2 子查询的类型 基于结果集的类型:单行/单列,单行/多列,多行/多列 完全独立的(非关联子查询)、引用包含语句中的列(关联查询) 9.3 非关联子查询 前面讲的都是非
阅读全文
摘要:本篇笔记主要分为两部分: 1,安装完毕之后的简单配置 2,数据的类型、简单的数据表操作命令 一、mysql安装完毕之后 windows和linux环境,除mysql的安装、配置有所不同,其他操作一样,本文在linux环境下操作。 启动(停止,重启)mysql服务: service mysql sta
阅读全文
摘要:183. Customers Who Never Order Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all cus
阅读全文
摘要:1、176题目,Second Highest Salary,https://leetcode.com/problems/second-highest-salary/#/description Write a SQL query to get the second highest salary fro
阅读全文
摘要:参考: 1、《SQL学习指南》 2、慕课网,SQL学习基础 提纲: 第二章 创建和使用数据库 2.1 创建MYSQL数据库 2.2 使用mysql命令行工具 2.3 MySQL数据类型 2.3.1 字符型数据 2.3.2 数值型数据 2.3.3 时间数据 2.4 表的创建 2.4.1 第一步:设计
阅读全文