You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE KEYSPACE IF NOT EXISTS resto_Fez
WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor': 1};
# pour les requetes qui suivents
use resto_Fez;
Création des Column Family:
# Création de la table restaurant, et les tables necessaires # pour modéliser les relations necessairesCREATETABLERestaurant (
id INTPRIMARY KEY,
name TEXT,
street TEXT,
building_number INT,
phone TEXT,
cuisine_type text
);
# Création de la table Inspection, et les tables necessaires CREATETABLEInspection (
restaurant_id INT,
inspection_date DATE,
violation_code TEXT,
violation_description TEXT,
score INT,
grade TEXT,
PRIMARY KEY ( restaurant_id, inspection_date )
);
Exercice 2:
SELECT*FROM Restaurant;
SELECT name FROM Restaurant;
SELECT name, street FROM Restaurant WHERE id=412;
SELECT inspection_date, grade from Inspection WHERE restaurant_id=412;
SELECT name FROM Restaurant where cuisine_type=‘mexicaine’ ALLOW FILTERING;
SELECT name FROM Restaurant where street=‘Florence’ ALLOW FILTERING;
SELECT grade, score FROM Inspection WHERE restaurant_id=412AND score >=10 ALLOW FILTERING;
SELECT grade FROM Inspection WHERE score >30AND grade >'' ALLOW FILTERING;
SELECTcount(*) FROM Inspection WHERE score >30AND grade >'' ALLOW FILTERING;
SELECT name FROM Restaurant WHERE token(id) >400LIMIT3;
CREATEINDEXretaurant_nameON restaurant (name);
SELECT name FROM restaurant
WHERE id IN (SELECT restaurant_id FROM Inspection WHERE Grade >= ‘A’);