Skip to content

Commit 9184d42

Browse files
committed
Section 07 Done
1 parent 58739ed commit 9184d42

7 files changed

+26
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT user_id, CONCAT(UPPER(SUBSTRING(name, 1, 1)), LOWER(SUBSTRING(name, 2))) AS name
2+
FROM Users
3+
ORDER BY 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT patient_id, patient_name, conditions
2+
FROM Patients
3+
WHERE conditions REGEXP '\\bDIAB1'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DELETE p1
2+
FROM Person p1, Person p2
3+
WHERE p1.email = p2.email AND p1.id > p2.id
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SELECT MAX(salary) AS SecondHighestSalary
2+
FROM Employee
3+
WHERE salary < (
4+
SELECT MAX(salary)
5+
FROM Employee
6+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT sell_date, count( DISTINCT product ) AS num_sold , GROUP_CONCAT( DISTINCT product ORDER BY product ASC separator ',' ) AS products
2+
FROM Activities GROUP BY sell_date
3+
ORDER BY sell_date ASC
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT p.product_name AS product_name, sum(o.unit) AS unit FROM Products p
2+
JOIN Orders o USING (product_id)
3+
WHERE YEAR(o.order_date)='2020' AND MONTH(o.order_date)='02'
4+
GROUP BY p.product_id
5+
HAVING SUM(o.unit)>=100
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT user_id, name, mail
2+
FROM Users
3+
WHERE mail REGEXP '^[a-zA-Z][a-zA-Z0-9_.-]*@leetcode[.]com$'

0 commit comments

Comments
 (0)