This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1/ Retourne le nom des équipes et le nombre de joueurs par équipe, le tout classé par nombre de joueurs par équipe, de la plus nombreuse à la moins nombreuse. | |
| mysql> SELECT name, COUNT(*) as number_player | |
| -> FROM team t | |
| -> JOIN player p ON p.team_id=t.id | |
| -> GROUP BY team_id | |
| -> ORDER BY number_player DESC; | |
| +------------+---------------+ | |
| | name | number_player | | |
| +------------+---------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysql> SELECT * FROM player p | |
| -> JOIN team t | |
| -> ON t.id=p.team_id; | |
| +------+-----------+---------+--------+-----------------+----+------------+ | |
| | id | wizard_id | team_id | role | enrollment_date | id | name | | |
| +------+-----------+---------+--------+-----------------+----+------------+ | |
| | 1 | 1 | 4 | beater | 1995-10-09 | 4 | Hufflepuff | | |
| | 2 | 2 | 1 | chaser | 1995-08-17 | 1 | Gryffindor | | |
| | 3 | 3 | 1 | seeker | 1994-12-03 | 1 | Gryffindor | | |
| | 4 | 4 | 3 | chaser | 1995-03-24 | 3 | Slytherin | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mysql> SELECT lastname, firstname, role, name FROM player | |
| JOIN team ON team.id=player.team_id | |
| JOIN wizard ON wizard.id=player.wizard_id | |
| ORDER BY name; | |
| +-----------------+-------------+--------+------------+ | |
| | lastname | firstname | role | name | | |
| +-----------------+-------------+--------+------------+ | |
| | | Cadogan | keeper | Gryffindor | | |
| | Weasley | Ginevra | keeper | Gryffindor | | |
| | Longbottom | Alice | beater | Gryffindor | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| const port = 3000; | |
| const connection = require('./conf'); | |
| // Support JSON-encoded bodies | |
| app.use(express.json()); | |
| // Support URL-encoded bodies | |
| app.use(express.urlencoded({ | |
| extended: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| const port = 3000; | |
| const connection = require('./conf'); | |
| // Support JSON-encoded bodies | |
| app.use(express.json()); | |
| // Support URL-encoded bodies | |
| app.use(express.urlencoded({ | |
| extended: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| const port = 3000; | |
| const connection = require('./conf'); | |
| //Midleware | |
| // Support JSON-encoded bodies | |
| app.use(express.json()); | |
| // Support URL-encoded bodies | |
| app.use(express.urlencoded({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| const port = 3000; | |
| const connection = require('./conf'); | |
| app.get('/api/movies', (req, res) => { | |
| // connection à la base de données, et sélection des employés | |
| connection.query('SELECT * from movie', (err, results) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| const port = 3000; | |
| app.get('/', (request, response) => { | |
| response.send('Bienvenue sur Express'); | |
| }); | |
| app.get('/api/movies', (request, response) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const http = require('http'); | |
| const port = 8000; | |
| const url = require('url'); | |
| const requestHandler = (request, response) => { | |
| console.log(request.url); | |
| const parsedUrl = url.parse(request.url, true).query; | |
| console.log(parsedUrl); | |
| if (parsedUrl.name && parsedUrl.city) { |
NewerOlder