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'); | |
| const bodyParser = require('body-parser'); | |
| app.use(bodyParser.json()); | |
| app.use(bodyParser.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
| 1.Retourne les noms, prénoms, rôle et équipe de tous les joueurs, classés dans l’ordre alphabétique par équipe, puis par rôle dans l’équipe, puis par nom de famille, puis par prénom. | |
| mysql> select lastname, firstname, role, name from wizard join player on wizard_id=wizard.id join team on team.id=player.team_id order by team.name; | |
| +-----------------+-------------+--------+------------+ | |
| | lastname | firstname | role | name | | |
| +-----------------+-------------+--------+------------+ | |
| | Weasley | Ronald | seeker | Gryffindor | | |
| | Weasley | Arthur | beater | Gryffindor | | |
| | Longbottom | Augusta | chaser | Gryffindor | | |
| | de | Nicholas | keeper | 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 bodyParser = require('body-parser'); | |
| // Support JSON-encoded bodies | |
| app.use(bodyParser.json()); | |
| // Support URL-encoded bodies | |
| app.use(bodyParser.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"); | |
| // écoute de l'url "/api/employees" | |
| app.get("/api/movie", (req, res) => { | |
| // connection à la base de données, et sélection des employés | |
| connection.query("SELECT * from movie", (err, results) => { | |
| if (err) { |
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; | |
| let movies = [ | |
| { id: 1, name: 'Homer'}, | |
| { id: 2, name: 'Bart'}, | |
| { id: 3, name: 'Lisa'} | |
| ] |
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 = 3000; | |
| const url = require('url'); | |
| const server = http.createServer((request, response) => { | |
| if(request.url === '/') { | |
| response.end("Bienvenue sur votre serveur !!"); | |
| } else if (request.url === '/contact') { | |
| { | |
| response.end("Nous ne sommes pas joignables pour le moment !"); |
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> INSERT INTO school (name, country, capacity) | |
| -> VALUES ('Beauxbatons Academy of Magic', 'France', 550), ('Castelobruxo', 'Brazil', 380), ('Durmstrang Institute', 'Norway', 570), ('Hogwarts School of Witchcraft and Wizardry', 'United Kingdom', 450), ('Ilvermorny School of Witchcraft and Wizardry', 'USA', 300), ('Koldovstoretz', 'Russia', 125), ('Mahoutokoro School of Magic', 'Japan', 800), ('Uagadou School of Magic', 'Uganda', 350); | |
| Query OK, 8 rows affected (0,01 sec) | |
| Records: 8 Duplicates: 0 Warnings: 0 | |
| mysql> update school | |
| -> set country='Sweden' | |
| -> where id=3; | |
| Query OK, 1 row affected (0,01 sec) | |
| Rows matched: 1 Changed: 1 Warnings: 0 |
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
| select * from wizard where birthday between '1975-01-01' and '1985-12-31' and is_muggle='0'; | |
| select * from wizard where firstname like 'H%'; | |
| select firstname, lastname from wizard where lastname='Potter' order by firstname; | |
| select firstname, lastname, birthday from wizard order by birthday asc limit 0,1; | |
NewerOlder