Giter Club home page Giter Club logo

social-media's Introduction

DATABASE : social-media

A basic social media database and its queries, implemented using the PostgreSQL DBMS. Accounts can message each other, send invititations to other accounts, make posts and react to those posts.

How to use ?

  1. Make sure you have PostgreSQL version 10 or higher installed on your OS (version 14 was used at the time of writing);
  2. To create the database and its tables : create a database, and run the social_media.sql in your PostgreSQL terminal;
  3. On PSQL, simply run : \i absolute/path/to/file
  4. Run the initializeMock.sql file to insert some mock accounts, aftewards, you can run the files in the mocks folder :
  • 1_mockInvites.sql,
  • 2_mockMessages.sql,
  • 3_mockPost.sql
  • 4_mockReactPost.sql
  1. Run some queries inside the select folder, or some queries of your own.
  2. Experiment, extend and enjoy ! Happy learning !

Database schema

Here is the database model, made with Jet Brain's Datagrip. It includes 5 tables : Account, Send_invites, Post, React_post, and Message.

alt text

Practice assignements

  1. Create a FakerJS script to generate 250_000 accounts like in initializeMock.sql file
  2. On which column would you add indexes and why ?
  3. Compare the performance difference of some queries when you have put all of your indexes VS. when it has no index at all.

social-media's People

Contributors

tokyramarozaka 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.