Coder Social home page Coder Social logo

bookstore's Introduction

You are given three tables:

create table books(id int, title varchar(250), year int, author varchar(250));

create table reviewers(id int, name varchar(250));

create table ratings(reviewer_id int, book_id int, rating int, rating_date date);

Problem statement | Estimate time: 30min

Find pairs of reviewers such as that both reviewers gave a rating to the same book.

Eliminate duplicates, don't pair reviewers with themselves, and include each pair only once.

Return reviewer from first column should have full name preceding name of second reviewer in alphabetical order.

Example output

name1 name2
Chris Thomas John Smith
Joe Martinez Mike Anderson

Sample data

Books:

id title year author
101 A Tale Of Two Cities 1859 Charles Dickens
102 The Lord of the Rings 1955 J.R.R. Tolkien
103 The Hobbit 1937 NULL
104 The Little Prince 1943 Antoine de Saint-Exupery

Reviewrs:

id name
15201 Joe Martinez
53202 Alice Lewis
44203 John Smith

Ratings:

reviewer_id book_id rating rating_date
15201 101 2 2015-02-11
15201 101 4 2015-06-16
53202 103 4 NULL

bookstore's People

Contributors

artemsyvko avatar

Stargazers

vittorioPiotti avatar Paul Koop avatar  avatar

Watchers

 avatar

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.