Code Monkey home page Code Monkey logo

bizlatinhub_1's Introduction

SQL DATABASE

estructura de la base de datos , falta la creacion de indices

CREATE DATABASE "biz" 

CREATE TABLE "biz"."tb_document_types" (
  "id" int NOT NULL AUTO_INCREMENT,
  "name_short" varchar(3) NOT NULL,
  "name" varchar(20) NOT NULL,
  "actived" tinyint(1) NOT NULL DEFAULT '1',
  "updated_at" datetime DEFAULT NULL,
  "created_at" datetime DEFAULT NULL,
  "deleted_at" datetime DEFAULT NULL,
  PRIMARY KEY ("id")
);


CREATE TABLE "biz"."tb_user_types" (
  "id" int NOT NULL AUTO_INCREMENT,
  "name" varchar(20) NOT NULL,
  "actived" tinyint(1) NOT NULL DEFAULT '1',
  "updated_at" datetime DEFAULT NULL,
  "created_at" datetime DEFAULT NULL,
  "deleted_at" datetime DEFAULT NULL,
  PRIMARY KEY ("id")
);




CREATE TABLE "biz"."tb_users" (
  "id" int NOT NULL AUTO_INCREMENT,
  "name" varchar(20) NOT NULL,
  "lastname" varchar(20) DEFAULT NULL,
  "documenttype_id" int NOT NULL,
  "document" varchar(11) NOT NULL,
  "usertype_id" int NOT NULL,
  "updated_at" datetime DEFAULT NULL,
  "created_at" datetime DEFAULT NULL,
  "deleted_at" datetime DEFAULT NULL,
  PRIMARY KEY ("id"),
  KEY "tb_user_FK" ("documenttype_id"),
  KEY "tb_user_FK_1" ("usertype_id"),
  CONSTRAINT "tb_user_FK" FOREIGN KEY ("documenttype_id") REFERENCES "biz"."tb_document_types" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT "tb_user_FK_1" FOREIGN KEY ("usertype_id") REFERENCES "biz"."tb_user_types" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
);

CREATE TABLE "biz"."tb_autos" (
  "id" int NOT NULL AUTO_INCREMENT,
  "marca" varchar(200) NOT NULL,
  "value" int NOT NULL,
  "model" varchar(20) NOT NULL,
  "year" year NOT NULL,
  "updated_at" datetime DEFAULT NULL,
  "created_at" datetime DEFAULT NULL,
  "deleted_at" datetime DEFAULT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "biz"."tb_sell_autos" (
  "id" int NOT NULL AUTO_INCREMENT,
  "user_id_sell" int NOT NULL,
  "user_id_buy" int NOT NULL,
  "auto_id" int NOT NULL,
  "updated_at" datetime DEFAULT NULL,
  "created_at" datetime DEFAULT NULL,
  "deleted_at" datetime DEFAULT NULL,
  PRIMARY KEY ("id"),
  KEY "tb_sell_auto_FK" ("auto_id"),
  KEY "tb_sell_auto_FK_1" ("user_id_sell"),
  KEY "tb_sell_auto_FK_2" ("user_id_buy"),
  CONSTRAINT "tb_sell_auto_FK" FOREIGN KEY ("auto_id") REFERENCES "biz"."tb_autos" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT "tb_sell_auto_FK_1" FOREIGN KEY ("user_id_sell") REFERENCES "biz"."tb_users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT "tb_sell_auto_FK_2" FOREIGN KEY ("user_id_buy") REFERENCES "biz"."tb_users" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT
);

bizlatinhub_1's People

Contributors

marioferyhwh avatar

Watchers

James Cloos avatar  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.