Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungWhy Claude Code keeps writing shell commands that fail on your Mac(20.09.2026 um 21:06 Uhr)
Sichere Programmierungllms.txt v2: What the Spec Says, and What 137,000 Domains Show(20.09.2026 um 21:17 Uhr)
Sicherheitslücken (CVE)NiceTryGPT: Less pattern matching. More actual hacking.(20.09.2026 um 21:19 Uhr)
IT Security VideoActivities BoF (kde2026)(20.09.2026 um 00:00 Uhr)
IT Security Toolsirdoc-app(20.09.2026 um 20:33 Uhr)
Sichere ProgrammierungWhy Claude Code keeps writing shell commands that fail on your Mac(20.09.2026 um 21:06 Uhr)
Sichere Programmierungllms.txt v2: What the Spec Says, and What 137,000 Domains Show(20.09.2026 um 21:17 Uhr)
Sicherheitslücken (CVE)NiceTryGPT: Less pattern matching. More actual hacking.(20.09.2026 um 21:19 Uhr)
IT Security VideoActivities BoF (kde2026)(20.09.2026 um 00:00 Uhr)
IT Security Toolsirdoc-app(20.09.2026 um 20:33 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

A Look into SQL Query Basics

Reagiere als Erste:r — dein Feedback zählt!

SQL is essential for the modern data professional. It is incorporated into most tools that drive data architectures. As such, it is important to have a solid understanding of the formative fundamentals.

Data definition language (DDL) VS Data Manipulation Language (DML)

SQL queries have commands and underlying syntax which can be grouped into several categories. Two of these are data definition language and data manipulation language.

Data definition language is used to modify the structure of the objects that hold data. They consist of commands such as CREATE, ALTER, DROP among others.

Data manipulation language commands are used to change the actual data. These include commands such as INSERT, UPDATE or even DELETE.

Other categories include:

  1. Data query language: used to retrieve data eg. SELECT
  2. Data control language: manage access and permissions to data eg. GRANT, REVOKE.

Let us look at brief commands examples that form the foundational structure of SQL. As convention, SQL specific commands are written in uppercase while user defined instructions are written in lowercase. SQL queries should always end with a semicolon (;).

-- 1. creating the schema
CREATE SCHEMA school_schema;

This creates a schema called school. Think of schema as the folder that will contain all related work in one place. In the case of SQL, these include tables, views, indexes etc. The '--' are comments which are not executed as part of the SQL command.

--setting the search path for the session
SET search_path = school_schema;

This is used in Postgresql to instruct that all the commands we will run should be executed in the schema given.

--creating a students table
CREATE TABLE students (
student_id INT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
gender VARCHAR(1),
date_of_birth DATE,
class VARCHAR(10),
city VARCHAR(50)
);
--Add a phone number column
ALTER TABLE students
ADD COLUMN
phone_number VARCHAR(20);

Renaming a column

--Rename credits column
ALTER TABLE subjects
RENAME COLUMN credits TO credit_hours;

Deleting a column

--Remove phone number column
ALTER TABLE students
DROP COLUMN phone_number;

Inserting data into a table

INSERT INTO students
VALUES
(1,'Amina','Wanjiku','f','2008-03-12','Form 3','Nairobi'),
(2,'Brian','Ochieng','m','2007-07-25','Form 4','Mombasa');

Updating a column in a record

UPDATE students
SET city = 'Nairobi' WHERE student_id = 1
RETURNING*;

The returning* keyword shows us the result of our query after we execute it. IF we don't explicitly give the WHERE clause, all the records will have their city column updated to Nairobi. The WHERE clause acts as a guardrail to prevent this.

Deleting a record

--Delete student with id 2
DELETE FROM students 
WHERE student_id = 2
RETURNING*;

Intermediate commands

--students neither in form 3 nor form 2
SELECT CONCAT(first_name,' ',last_name) AS student,class
FROM students GROUP BY class,student
HAVING class NOT IN ('form 3','Form 2') ORDER BY class;

sql not in

Case statement to check condition first before assigning a value

--students classification as 'Senior' or 'Junior'
SELECT first_name,last_name,class,
CASE
    WHEN class IN ('Form 3', 'Form 4') THEN 'Senior'
    ELSE 'Junior'
END AS student_level
FROM students;

Case in sql

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten A Look into SQL Query Basics

Thematisch verwandte Begriffe: Look, into, Query, Basics · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93956 | A flaw has been found in olivier-ls PHP-FTS up to 1.1.2. Affected by thi…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick