Data is one of the most important components of geospatial technology and perhaps any other industry. Data management is now taken seriously in all industries, so knowledge in this discipline is essential for an IT professional's careers. This article series is intended to be a one-stop guide in which we'll cover the topic inside and out, starting with the question "What is data?" and ending with the study and application of geospatial queries.
Basic Database Concepts
What is data?
Data can be any information that is stored for the purpose of future reference. This information can include numbers, text, audio and video footage, location, dates, and more. It can be written down on paper or stored on your computer's hard drive or even in the cloud.
What is a database?
, , . , . : , , , , , Facebook . , - .
?
. , , , NoSQL ( ). - , , , . . , , .
()
, , , ? . โ , , , , . . API. , . , , . . .
, . . , - . . , > 15, - : 10 . .
: . . , , . 99 % , .
, , , , , . Excel Google Spreadsheets, .
, , . , , . , .
.
NoSQL, , ( โ . .). , ( , . .), โ . SQL (Structured Query Language โ ), , . SQL . SQL . : PostgreSQL, MySQL, MS SQL . . , , SQL. , - , (, PostgreSQL MySQL).
(NoSQL)
, , . , :
ยซ-ยป
JSON, XML
NoSQL , . , Core_user, .
NoSQL Google Firebase
NoSQL , . NoSQL, Firebase MongoDB, JSON. -, JavaScript, Python, Ruby . .
, , , , . . , , . , , (, , . .). , SQL , . , PostGIS PostgreSQL, . , NoSQL : , MongoDB - . .
, . PostgreSQL, , PostGIS . PostgreSQL, . PostgreSQL pgAdmin. pgAdmin - . - .
, , , , , . ., . , .
. ( ).
(Query Tool) :
CREATE DATABASE <database_name>
pgAdmin
, Not Null
( ), Primary Key
( ) . . .
, , PostgreSQL . . , , ( ). :
CREATE TABLE <table_name> (
<column_1> <datatype>,
<column_2> <datatype>,
..
.
..
<column_n> <datatype>
PRIMARY KEY (<column>)
);
CRUD-
CRUD- (, , โ Create, Retrieve, Update, Delete) โ hello world . , . pgAdmin, :
1.
:
INSERT INTO <tablename> (column1, column2, column3,...) VALUES (value1, value2, value3,...);
INSERT, INTO, VALUE SQL, , . . , :
INSERT INTO users(name, employed, address) VALUES ('Sheldon Cooper', true, 'Pasadena');
: ' ' ( ), " " ( ).
2. ( )
, , . . :
select <column1, column2 ,...> from <tablename>
. 20 , :
select <column1, column2 ,...> from <tablename> limit 20
, :
select * from <tablename>
, WHERE, :
select * from <tablename> where <key> = <value>
, . :
--Retrieving Specific columns for all users
select name,employed from users
--Retrieving all columns for all users
select * from users
--Retrieving all columns for first 3 users
select * from users limit 3
--Retrieving all columns for all users where employed = true
select * from users where employed = true
3. ( ) , .
UPDATE <tablename>
SET <column1> = <value1>, <column2> = <value2>
, WHERE:
UPDATE <tablename>
SET <column1> = <value1>, <column2> = <value2>
WHERE <column> = <value>
:
-- Make all rows as employed = true
update users set employed = true
-- change employed = false for entries with address = 'nebraska'
update users set employed = false where address = 'nebraska'
4. ( ) SQL . , , WHERE.
-- Deleting all entries
Delete from <tablename>
-- Deleting entries based on conditions
Delete from <tablename> where <column> = <value>
-- Deleting all entries
Delete from users
-- Deleting entries based on conditions
Delete from users where employed = false
CRUD- , .
ยซ ยป. - ยซ PostgreSQL. ยป. : ; . .