Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbd-alg-2022
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
joel.cavat
sbd-alg-2022
Commits
98e5daa8
Commit
98e5daa8
authored
2 years ago
by
Joel Cavat
Browse files
Options
Downloads
Patches
Plain Diff
Update corr
parent
1b3fd9dc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
corrections/chapitre_05/conf.sql
+19
-3
19 additions, 3 deletions
corrections/chapitre_05/conf.sql
with
19 additions
and
3 deletions
corrections/chapitre_05/conf.sql
+
19
−
3
View file @
98e5daa8
...
@@ -122,7 +122,7 @@ SELECT C.name, start_date, end_date,
...
@@ -122,7 +122,7 @@ SELECT C.name, start_date, end_date,
FROM
Conference
AS
C
;
FROM
Conference
AS
C
;
-- 15
-- 15
SELECT
name
,
SUM
(
fees
)
AS
total
SELECT
name
,
SUM
(
IFNULL
(
fees
,
0
)
)
AS
total
FROM
Conference
AS
C
FROM
Conference
AS
C
LEFT
JOIN
Participation
AS
P
ON
C
.
id_conference
=
P
.
id_conference
LEFT
JOIN
Participation
AS
P
ON
C
.
id_conference
=
P
.
id_conference
GROUP
BY
C
.
id_conference
GROUP
BY
C
.
id_conference
...
@@ -176,14 +176,29 @@ INNER JOIN Participation AS P ON C.id_conference = P.id_conference
...
@@ -176,14 +176,29 @@ INNER JOIN Participation AS P ON C.id_conference = P.id_conference
WHERE
login
LIKE
"stregunna14"
;
WHERE
login
LIKE
"stregunna14"
;
-- 20
-- 20
SELECT
S
.
login
,
firstname
,
lastname
,
fees
SELECT
DISTINCT
S
.
login
,
firstname
,
lastname
,
fees
FROM
Speaker
AS
S
FROM
Speaker
AS
S
INNER
JOIN
Participation
AS
P
ON
S
.
login
=
P
.
login
INNER
JOIN
Participation
AS
P
ON
S
.
login
=
P
.
login
WHERE
fees
=
(
WHERE
fees
=
(
SELECT
MAX
(
fees
)
FROM
Participation
SELECT
MAX
(
fees
)
FROM
Participation
);
);
-- 21
-- 21
SELECT
Speaker
.
login
,
firstname
,
lastname
FROM
Speaker
INNER
JOIN
Participation
ON
Speaker
.
login
=
Participation
.
login
GROUP
BY
Speaker
.
login
HAVING
SUM
(
fees
)
=
(
SELECT
MAX
(
SUM
)
FROM
(
SELECT
login
,
SUM
(
fees
)
AS
SUM
FROM
Participation
GROUP
BY
login
));
SELECT
S
.
login
,
firstname
,
lastname
,
SUM
(
fees
)
AS
F
SELECT
S
.
login
,
firstname
,
lastname
,
SUM
(
fees
)
AS
F
FROM
Speaker
AS
S
FROM
Speaker
AS
S
INNER
JOIN
Participation
AS
P
ON
S
.
login
=
P
.
login
INNER
JOIN
Participation
AS
P
ON
S
.
login
=
P
.
login
...
@@ -194,6 +209,7 @@ HAVING F = (
...
@@ -194,6 +209,7 @@ HAVING F = (
)
AS
G
)
AS
G
);
);
WITH
GBY
(
login
,
firstname
,
lastname
,
sum
)
AS
(
WITH
GBY
(
login
,
firstname
,
lastname
,
sum
)
AS
(
SELECT
S
.
login
,
firstname
,
lastname
,
SUM
(
fees
)
AS
F
SELECT
S
.
login
,
firstname
,
lastname
,
SUM
(
fees
)
AS
F
FROM
Speaker
AS
S
FROM
Speaker
AS
S
...
@@ -227,7 +243,7 @@ WHERE login NOT IN (
...
@@ -227,7 +243,7 @@ WHERE login NOT IN (
);
);
-- 24
-- 24
SELECT
substr
(
A
.
lastname
,
1
,
2
)
AS
SUB
,
A
.
firstname
,
A
.
lastname
,
B
.
firstname
,
B
.
lastname
SELECT
substr
(
A
.
lastname
,
1
,
2
)
AS
SUB
,
A
.
login
,
A
.
firstname
,
A
.
lastname
,
B
.
login
,
B
.
firstname
,
B
.
lastname
FROM
Visitor
AS
A
FROM
Visitor
AS
A
INNER
JOIN
Visitor
AS
B
ON
substr
(
A
.
lastname
,
1
,
2
)
=
substr
(
B
.
lastname
,
1
,
2
)
INNER
JOIN
Visitor
AS
B
ON
substr
(
A
.
lastname
,
1
,
2
)
=
substr
(
B
.
lastname
,
1
,
2
)
WHERE
A
.
login
>
B
.
login
WHERE
A
.
login
>
B
.
login
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment