Coder Social home page Coder Social logo

java-filmorate's Introduction

java-filmorate

Template repository for Filmorate project.

Диаграма

String sqlUpdateUserById = "update users set name = ?, login = ?, email = ?, birthday = ? where id = ?";

String sqlGetUserById = "select id, name, login, email, birthday from users where id = ?";

String sqlGetAllUsers = "select id, name, login, email, birthday from users";

String sqlSelectFriendStatus = "select COUNT(status) > 0 from friends where user_id = ? and friend_id = ?";

String sqlAddFriend = "insert into friends(user_id, friend_id, status) values (?, ?, ?)";

String sqlDeleteFriend = "delete from friends where user_id = ? and friend_id = ?";

String sqlGetFriendsByUserId = "select id, name, login, email, birthday from users u inner join friends f on u.id = f.friend_id where f.user_id = ?";

String sqlGetMutualFriends = "select id, name, login, email, birthday from users where id in (select f.friend_id from friends as f inner join friends as f2 on f.friend_id = f2.friend_id where f.user_id = ? and f2.user_id = ?)";

String sqlGetFriendsIdByUserId = "select friend_id from friends where user_id = ?";

String sqlUpdateFilmById = "update films set name = ?, description = ?, duration = ?, release_date = ?, mpa_id = ? where id = ?";

String sqlGetFilmById = "select id, name, description, duration, release_date, rate from films where id = ?";

String sqlGetAllFilms = "select id, name, description, duration, release_date, rate from films order by id";

String sqlGetAllFilmsByLikesCount = "select id, name, description, duration, release_date, rate from films order by rate DESC limit ?";

String sqlLinkFilmWithGenre = "insert into film_genres (film_id, genre_id) values (?, ?)";

String sqlUnlinkFilmWithGenre = "delete from film_genres where film_id = ?";

String sqlGetGenreById = "select id, name from genres where id = ?";

String sqlGetAllGenres = "select id, name from genres";

String sqlGetGenresByFilmId = "select id, name from genres g inner join film_genres fg on g.id = fg.genre_id where fg.film_id = ?";

String sqlGetLikesCountByFilmId = "select count(user_id) from likes where film_id = ?";

String sqlGetLikesByFilmId = "select user_id from likes where film_id = ?";

String sqlAddLike = "insert into likes (film_id, user_id) values (?, ?)";

String sqlIncreaseFilmRate = "update films set rate = (select COUNT(user_id) as rate from likes where film_id = ?) where id = ?";

String sqlDeleteLike = "delete from likes where film_id =? and user_id = ?";

String sqlDecreaseFilmRate = "update films set rate = (select COUNT(user_id) as rate from likes where film_id = ?) where id = ?";

String sqlGetMpaRatingById = "select id, name from mpa_ratings where id = ?";

String sqlGetAllMpaRatings = "select id, name from mpa_ratings";

String sqlGetMpaRatingsByFilmId = "select mpa.id, mpa.name from mpa_ratings mpa inner join films f on mpa.id = f.mpa_id where f.id = ?";

java-filmorate's People

Contributors

alesya87 avatar

Watchers

 avatar

java-filmorate's Issues

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.