GithubHelp home page GithubHelp logo

java-filmorate's Introduction

java-filmorate

Репозиторий для проекта Filmorate.

Схема базы данных

https://dbdiagram.io/d/66cd4a9f3f611e76e99165ef

Снимок экрана 2024-08-28 в 01 17 08
CREATE TABLE "genre" (
  "film_id" int PRIMARY KEY,
  "name" varchar
);

CREATE TABLE "film_genre" (
  "film_id" bigint,
  "genre_id" bigint,
  PRIMARY KEY ("film_id", "genre_id")
);

CREATE TABLE "users" (
  "film_id" bigint PRIMARY KEY,
  "name" varchar,
  "login" varchar,
  "email" varchar,
  "birthday" data
);

CREATE TABLE "likes" (
  "film_id" bigint,
  "user_id" bigint,
  PRIMARY KEY ("film_id", "user_id")
);

CREATE TABLE "mpa" (
  "film_id" int PRIMARY KEY,
  "name" varchar
);

CREATE TABLE "friends" (
  "user_id" bigint,
  "user_friend_id" bigint,
  "status" bool,
  PRIMARY KEY ("user_id", "user_friend_id")
);

CREATE TABLE "films" (
  "film_id" bigint PRIMARY KEY,
  "name" varchar,
  "description" varchar,
  "release_date" date,
  "duration" int,
  "mpa_id" int
);

ALTER TABLE "film_genre" ADD FOREIGN KEY ("genre_id") REFERENCES "genre" ("film_id");

ALTER TABLE "film_genre" ADD FOREIGN KEY ("film_id") REFERENCES "films" ("film_id");

ALTER TABLE "films" ADD FOREIGN KEY ("mpa_id") REFERENCES "mpa" ("film_id");

ALTER TABLE "likes" ADD FOREIGN KEY ("film_id") REFERENCES "films" ("film_id");

ALTER TABLE "likes" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("film_id");

ALTER TABLE "friends" ADD FOREIGN KEY ("user_friend_id") REFERENCES "users" ("film_id");

ALTER TABLE "friends" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("film_id");

Пример использования запроса

Получение списка самых популярных фильмов:

SELECT f.* FROM films f 
JOIN likes l ON f.ID = l.film_id 
GROUP BY f.id 
ORDER BY COUNT(l.user_id) DESC"

java-filmorate's People

Contributors

sergeanthoma avatar

Watchers

 avatar

java-filmorate's Issues

тесты противоречат гитигнору

if [[ "$FILENAMES" =~ ".class" ]] [[ "$FILENAMES" =~ ".jar" ]] [[ "$FILENAMES" =~ "mvn" ]] [[ "$FILENAMES" =~ ".DS_Store" ]] \ [[ "$FILENAMES" =~ ".idea" ]] [[ "$FILENAMES" =~ ".iws" ]] [[ "$FILENAMES" =~ ".iml" ]] [[ "$FILENAMES" =~ ".ipr" ]] \ [[ "$FILENAMES" =~ ".db" ]] [[ "$FILENAMES" =~ ".log" ]] [[ "$FILENAMES" =~ "out/" ]] [[ "$FILENAMES" =~ "target/" ]] then echo "The pull request contains the binary files. Remove them (*.class, *.jar, *.DS_Store ...) from PR" echo "Pull request содержит двоичные файлы. Удалите их (*.class, *.jar, *.DS_Store ...) из PR" exit -3

против

!.mvn/wrapper/maven-wrapper.jar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.