By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
version() |
---|
8.0.23 |
id | first_name | last_name | date_of_birth | preferred_royalties |
---|---|---|---|---|
1 | joe | james | 1975-08-21 | 15.00 |
2 | jane | scully | 1980-01-01 | 17.00 |
3 | dimitriy | volkov | 1961-12-07 | 21.00 |
id | NAME | date_published | msrp | copies_sold | author_id | publisher_id |
---|---|---|---|---|---|---|
1 | MySQL Book 1 | 2001-01-19 | 400.00 | 100 | 1 | 1 |
2 | MariaDB vs MySQL | 2005-12-03 | 500.00 | 200 | 2 | 2 |
3 | The art of Kungfu | 1991-07-29 | 600.00 | 999 | 3 | 3 |
4 | The art of Judo | 2007-09-27 | 405.00 | 150 | 3 | 3 |
5 | The art of Capoeira | 2011-08-09 | 785.00 | 90 | 3 | 3 |
id | NAME | standard_royalties |
---|---|---|
1 | Book Publisher inc | 17.00 |
2 | The Book co | 15.00 |
3 | Martial Books | 20.00 |
id | first_name | last_name | date_of_birth | preferred_royalties | id | NAME | date_published | msrp | copies_sold | author_id | publisher_id | id | NAME | standard_royalties |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | joe | james | 1975-08-21 | 15.00 | 1 | MySQL Book 1 | 2001-01-19 | 400.00 | 100 | 1 | 1 | 1 | Book Publisher inc | 17.00 |
2 | jane | scully | 1980-01-01 | 17.00 | 2 | MariaDB vs MySQL | 2005-12-03 | 500.00 | 200 | 2 | 2 | 2 | The Book co | 15.00 |
3 | dimitriy | volkov | 1961-12-07 | 21.00 | 5 | The art of Capoeira | 2011-08-09 | 785.00 | 90 | 3 | 3 | 3 | Martial Books | 20.00 |
3 | dimitriy | volkov | 1961-12-07 | 21.00 | 4 | The art of Judo | 2007-09-27 | 405.00 | 150 | 3 | 3 | 3 | Martial Books | 20.00 |
3 | dimitriy | volkov | 1961-12-07 | 21.00 | 3 | The art of Kungfu | 1991-07-29 | 600.00 | 999 | 3 | 3 | 3 | Martial Books | 20.00 |
first_name | last_name | EarningByBook | copies_sold | Years |
---|---|---|---|---|
joe | james | 1700.00 | 100 | 20 |
jane | scully | 3400.00 | 200 | 16 |
dimitriy | volkov | 1890.00 | 90 | 10 |
dimitriy | volkov | 3150.00 | 150 | 14 |
dimitriy | volkov | 20979.00 | 999 | 30 |
first_name | last_name | Lifetime Earning | Copies Sold | Total Years | AVG earning per year |
---|---|---|---|---|---|
joe | james | 1700.00 | 100 | 20 | 85.000000 |
jane | scully | 3400.00 | 200 | 16 | 212.500000 |
dimitriy | volkov | 26019.00 | 1239 | 54 | 481.833333 |
name | standard_royalties |
---|---|
Book Publisher inc | 17.00 |
The Book co | 15.00 |
Martial Books | 20.00 |
id | NAME | date_published | msrp | copies_sold | author_id | publisher_id | Decade | copies_sold |
---|---|---|---|---|---|---|---|---|
1 | MySQL Book 1 | 2001-01-19 | 400.00 | 100 | 1 | 1 | 2000 | 100 |
2 | MariaDB vs MySQL | 2005-12-03 | 500.00 | 200 | 2 | 2 | 2000 | 200 |
3 | The art of Kungfu | 1991-07-29 | 600.00 | 999 | 3 | 3 | 1990 | 999 |
4 | The art of Judo | 2007-09-27 | 405.00 | 150 | 3 | 3 | 2000 | 150 |
5 | The art of Capoeira | 2011-08-09 | 785.00 | 90 | 3 | 3 | 2010 | 90 |
Decade | Copies Sold | Total Sales | Avg MSRP |
---|---|---|---|
2000 | 450 | 200750.00 | 9.200000 |
1990 | 999 | 599400.00 | 0.600601 |
2010 | 90 | 70650.00 | 8.722222 |
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUM(copies_sold) AS 'Books Sold',
SUM(msrp*copies_sold) AS 'Total Sales',
SUM(ms' at line 2
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'From author
INNER JOIN book
ON author.id = book.author_id)
(SELECT Datediff(book' at line 2
first_name | last_name | date_of_birth | age |
---|---|---|---|
joe | james | 1975-08-21 | 25 |
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT publisher.name, book.msrp
From Publisher
INNER JOIN book ON book.publis' at line 17
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT publisher.name, book.msrp
From publisher
INNER JOIN book ON publisher.i' at line 17
name | msrp |
---|---|
Book Publisher inc | 400.00 |
The Book co | 500.00 |
Martial Books | 600.00 |
Martial Books | 405.00 |
Martial Books | 785.00 |
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN book ON publisher.id = book.publisher_id)
FROM author A
JOIN book B ' at line 14
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT publisher.name, book.msrp
From publisher
INNER JOIN book ON publisher.' at line 13
Level | Code | Message |
---|---|---|
Error | 1064 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT publisher.name, book.msrp From publisher INNER JOIN book ON publisher.' at line 13 |