Search
 
SCRIPT & CODE EXAMPLE
 

SQL

SQL TABLE : SUBSCRIPTION, PRODUCT, SPECIFICATION

create table SUBSCRIPTION (
  MSISDN int(13),
  PRODUCT_ID int(7),
  EFFECTIVE_DATE date&time,
  EXPIRED_DATE date&time,
  PRIMARY KEY (PRODUCT_ID));

create table PRODUCT (
  PRODUCT_ID int(7),
  PRODUCT_NAME varchar(30),
  FOREIGN KEY (PRODUCT_ID));
  
create table SPECIFICATION (
  PRODUCT_ID int(7),
  PRICE int(8),
  FOREIGN KEY (PRODUCT_ID));
  
Comment

SQL TABLE : SUBSCRIPTION, PRODUCT, SPECIFICATION

create database test_coderbyte;
use test_coderbyte;
create table SUBSCRIPTION (
  MSISDN int(13),
  PRODUCT_ID int(7) PRIMARY KEY AUTO_INCREMENT,
  EFFECTIVE_DATE TIMESTAMP,
  EXPRIRED_DATE TIMESTAMP);
  
insert into SUBSCRIPTION (MSISDN, PRODUCT_ID, EFFECTIVE_DATE, EXPIRED_DATE) value
  (6287889918951, 8212362, '2020-11-19 09:56:58', '2020-12-19 09:56:51'),
  (6287884073148, 8211036, '2020-11-19 08:52:19', '2020-11-22 08:52:17'),
  (6287775663617, 8211310, '2020-11-19 08:38:04', '2020-12-19 00:00:00'),
  (6287884073148, 8211036, '2020-11-18 21:04:28', '2020-11-21 21:04:26');
  
create table PRODUCT (
  PRODUCT_ID int(7) FOREIGN KEY,
  PRODUCT_NAME varchar(30));
 
insert into PRODUCT (PRODUCT_ID, PRODUCT_NAME) value 
  (8211036, "Keluarga 10GB, 3hr, 10rb"),
  (8211310, "BIZ Pro"),
  (8212226, "XTRA Combo 5GB+5GB, 54.000"),
  (8212362, "Xtra Combo Lite 21GB, 30hr");
  
create table SPECIFICATION (
  PRODUCT_ID int(7) FOREIGN KEY,
  PRICE int(8));
  
insert into SPECIFICATION (PRODUCT_ID, PRICE) value 
  (8211036, 10000),
  (8211310, 149000),
  (8212226, 54000),
  (8212362, 105000);
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql grant execute 
Sql :: sql developer export connections 
Sql :: heroku postgres permission denied 
Sql :: python sql passer des parametres dans une requet pymysql 
Sql :: sql server: how to assign value to table variable returned from function 
Sql :: what is constraints in dbms 
Sql :: how to add column in oracle 
Sql :: allow null sql 
Sql :: how to run sql script in postgresql in windows 
Sql :: sql null functions 
Sql :: user multiple mysql server mac 
Sql :: proc sql not in working 
Sql :: amount to words oracle Function 
Sql :: database traccar 
Sql :: update or delete on table "model" violates foreign key constraint 
Sql :: alter table add column integer default 0 
Sql :: MySQL Quartiles in SQL query 
Sql :: mysql load data infile default file location 
Sql :: how to add mysql to path on termin after installation 
Sql :: plsql to generate all combinations of specified number of characters in string 
Sql :: normal mysql large import 
Sql :: insert into one table from another table in oracle 
Sql :: sql syntax chekcer 
Sql :: localhost ERROR 2006 (HY000) at line 1163: MySQL server has gone away 
Sql :: psql commande gset 
Sql :: join mysql 
Sql :: select between dates opstgres 
Sql :: list foreign user mapping postgres 
Sql :: mysql vs sql server performance benchmark 
Sql :: dbms transaction tutorialspoint 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =