technical skills grow

Responsive Ads Here

Sunday, August 15, 2021

CREATE TABLE | INSERT DATA | VIEW

Ex: - 

CREATE TABLE public.airports
(
  latitude double precision,
  longitude double precision,
  max double precision,
  min double precision,
  rain double precision,
  year integer,
  month integer,
  day integer,
  gid integer NOT NULL DEFAULT nextval('airports_gid_seq'::regclass),
  geom geometry(Point,4326),
  CONSTRAINT airports_pkey PRIMARY KEY (gid)
)
-- Index: public.idx_airports_geom

-- DROP INDEX public.idx_airports_geom;

CREATE INDEX idx_airports_geom
  ON public.airports
  USING gist
  (geom);

Ex:-

CREATE TABLE STATION
(
ID int ,
STATION_NAME VARCHAR(100) NOT NULL ,
TEMP_MAX double precision,
TEMP_MIN double precision,
TEMP_AVG double precision
)

select * from STATION;

insert into STATION (ID,STATION_NAME,TEMP_MAX,TEMP_MIN,TEMP_AVG) values (1,'AGRA',34.56,25.45,20.50);

Ex-3


CREATE TABLE public.aws_station
(
  id integer NOT NULL DEFAULT nextval('aws_station_id_seq'::regclass),
  created_on date,
  state character varying(100),
  district character varying(100),
  tehsil character varying(100),
  station character varying(100),
  station_id integer,
  last_record timestamp without time zone,
  lat double precision,
  lon double precision,
  CONSTRAINT aws_station_pkey PRIMARY KEY (id)
);
 

Ex: 4 -

-- DROP TABLE public.aws_station_data;

CREATE TABLE public.aws_station_data
(
  id integer NOT NULL DEFAULT nextval('aws_station_data_id_seq'::regclass),
  created_on date,
  station character varying(100),
  station_id integer,
  datadate_time timestamp without time zone,
  mintemp double precision,
  maxtemp double precision,
  rh double precision,
  rain double precision,
  temp_av double precision,
  maxwind double precision,
  minwind double precision,
  wind_av double precision,
  wind_dir double precision,
  wind_speed double precision,
  qccheck character varying(50),
  source character varying(50) DEFAULT 'AWS'::character varying,
  CONSTRAINT aws_station_data_pkey PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE public.aws_station_data
  OWNER TO postgres;

Ex-5

CREATE TABLE public.india
(
  gid integer NOT NULL DEFAULT nextval('india_gid_seq'::regclass),
  state_name character varying(75),
  geom geometry(MultiPolygon,4326),
  CONSTRAINT india_pkey PRIMARY KEY (gid)
)


No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts