This article provides three SQL statement instance codes for table creation, one-to-one test, and explains how to use SQL to create data tables and databases.
This article provides three SQL statement instance codes for table creation, one-to-one test, and explains how to use SQL to create data tables and databases.
This article provides three SQL statement instance codes for table creation, one-to-one test and explains how to use SQL to create data tables and explain instances.
Drop table cell_tch;
Drop table MS;
Drop table msc;
Drop table bsc;
Drop table bts;
Drop table cell;
Drop table antenna;
Drop table data;
Drop table test;
Drop table neighbor;
Create table msc (
Mscid integer not null,
Mscname character (10 ),
Msccompany character (10 ),
Msclong1_decimal (9, 6 ),
Msclatitude decimal (8, 6 ),
Mscaltitude integer,
Primary key (mscid ));
Create table bsc (
Bscid integer not null,
Bscname character (10 ),
Bsccompany character (10 ),
Longbench decimal (9, 6 ),
Latitude decimal (8, 6 ),
Mscid integer,
Primary key (bscid ),
Foreign key (mscid) references msc (mscid ));
Create table bts (
Btsname character (20) not null,
Bscid integer not null,
Longbench decimal (9, 6 ),
Latitude decimal (8, 6 ),
Altitude integer,
Btscompany character (10 ),
Btspower decimal (2, 1 ),
Primary key (btsname ),
Foreign key (bscid) references bsc (bscid ));
Create table cell (
Cellid integer not null,
Btsname character (20 ),
Areaname character (10 ),
Lac integer,
Longbench decimal (9, 6 ),
Latitude decimal (8, 6 ),
Direction integer,
Radious integer,
Antnum integer,
Bcch integer,
Primary key (cellid ),
Foreign key (btsname) references bts (btsname ));
Create table MS (
Imei bigint not null,
Msisdn bigint,
Username varchar (10 ),
Mscompany varchar (20 ),
Gsmmsense integer,
Gsmmsheight decimal (3, 2 ),
Gsmmspfout decimal (3, 2 ),
Mzone character (10 ),
Cellid integer,
Primary key (imei ),
Foreign key (cellid) references cell (cellid ));
Create table antenna (
Cellid integer not null,
Antennahigh integer,
Halfpangle integer,
Maxattenuation integer,
Gain integer,
Anttilt integer,
Pt integer,
Mspwr integer,
Primary key (cellid ));
Create table cell_tch (
Cellid integer,
Freq integer,
Foreign key (cellid) references cell (cellid ));
Create table data (
Date integer not null,
Time integer not null,
Cellid integer not null,
Ntch integer,
Traff decimal (9, 7 ),
Rate decimal (10, 9 ),
Thtraff decimal (9, 7 ),
Callnum integer,
Congsnum integer,
Callcongs decimal (10, 9 ),
Primary key (date, time, cellid ));
Create table test (
Keynum integer not null,
Cellid integer,
Latitude decimal (9, 6 ),
Longbench decimal (8, 6 ),
Rxlevdecimal (9, 6 ),
Primary key (keynum ),
Foreign key (cellid) references cell (cellid ));
Create table neighbor (
Cellid integer,
Adjcellid integer,
Celllac integer,
Adjcelllac integer,
Foreign key (cellid) references cell (cellid ));
Import from "c: msc.csv" of del method p (1, 2, 3, 4, 5, 6) messages "1" insert into db2admin. msc (mscid, mscname, msccompany, msclongpolling, msclatitude, mscaltitude );
Import from "c: bsc.csv" of del method p (1, 2, 3, 4, 5, 6) messages "1" insert into db2admin. bsc (bscid, bscname, bsccompany, longpolling, latitude, mscid );
Import from "c: bts.csv" of del method p (1, 2, 3, 4, 5, 6, 7) messages "1" insert into db2admin. bts (btsname, bscid, longpolling, latitude, altitude, btscompany, btspower );
Import from "c: cell.csv" of del method p (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) messages "1" insert into db2admin. cell (cellid, btsname, areaname, lac, longpolling, latitude, direction, radous, antnum, bcch );
Import from "c: data.csv" of del method p (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) messages "1" insert into "data" (date, time, cellid, ntch, traff, rate, thtraff, callnum, congsnum, callcongs );
Import from "c: ms.csv" of del method p (1, 2, 3, 4, 5, 6, 7, 8, 9) messages "1" insert into db2admin. ms (imei, msisdn, username, mscompany, gsmmspsense, gsmmsheight, gsmmspfout, mzone, cellid );
Import from "c: cell_tch.csv" of del method p (1, 2) messages "1" insert into db2admin. cell_tch (cellid, freq );
Import from "c: test.csv" of del method p (1, 2, 3, 4, 5) messages "1" insert into db2admin. test (keynum, cellid, latitude, longpolling, rxev );
Import from "c: antenna.csv" of del method p (1, 2, 3, 4, 5, 6, 7, 8) messages "1" insert into db2admin. antenna (cellid, antennahigh, halfpangle, maxattenuation, gain, anttilt, pt, mspwr );
Import from "c: neighbor.csv" of del method p (1, 2, 3, 4) messages "1" insert into db2admin. neighbor (cellid, adjcellid, celllac, adjcelllac );
The above two columns are written, and the rest are similar. duplicate names are not allowed, just add "constraints.