0% found this document useful (0 votes)
30 views

Chapter One

This document contains an introduction to SQL commands used for database structure and management. It discusses tables, which contain columns, indexes, foreign keys and triggers. It explains how to create, alter and drop tables using SQL commands. It also covers how to insert, select, update and delete data from tables, including the syntax for these SQL commands and how to add constraints to columns. The document is divided into two chapters, with the first chapter focusing on SQL commands for database structure and table management, and the second chapter possibly discussing additional SQL topics.

Uploaded by

Dejene Tadesa
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Chapter One

This document contains an introduction to SQL commands used for database structure and management. It discusses tables, which contain columns, indexes, foreign keys and triggers. It explains how to create, alter and drop tables using SQL commands. It also covers how to insert, select, update and delete data from tables, including the syntax for these SQL commands and how to add constraints to columns. The document is divided into two chapters, with the first chapter focusing on SQL commands for database structure and table management, and the second chapter possibly discussing additional SQL topics.

Uploaded by

Dejene Tadesa
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

NAAF TA’EERA

2023 G.C
NAAF TA’EERA

Your
text
Your text he£Ԛre

[Author name]
[Company name]
2023 G.C

|Page
NAAF TA’EERA

Contents
Introduction to SQL Commands.................................................................................................2

1.1 Structure.......................................................................................................................2

1.1.1 Tables........................................................................................................................2

CHAPTER TWO........................................................................................................................3

i|Page
NAAF TA’EERA

Chapter one

Introduction to SQL Commands


1.1 Structure
While database is created we should have to great care for most four things which are more
and more crucial for our system. These includes:
Function
Stored Procedures and
Tables
Views
1.1.1 Tables
Once a table is created it contains columns which have an index, Foreign keys and Triggers.
To create a table, we can use the following command;
CREATE TABLE table name ( your data field with the data type);
Sometimes we wanna to delete our table by using drop statement.
DROP TABLE table name;
Alter is another statement used to add, delete and modify columns in the existing table,
Syntax;
ALTER TABLE table name ADD column_name DATA TYPE;
ALTER TABLE table name MODIFY COLUMN column name DATA TYPE;
ALTER TABLE table name DROP COLUMN column name;
What are the constraints with certain columns? [1]
Constraint guides how data within a column is governed.
Some of them are;
Foreign key: Uniquely identifies a row / record in another table.
How to insert a values to a created table in a database?
Not null: columns cannot have null values.
Primary key: Combination of not null and unique.
Unique: Ensure that all values in columns are different.
While we wanna to incorporate new value to the created table; we should have to first check
the requested data type and easily accessed by using the below command.
Syntax;
INSERT INTO table name VALUES (value1, value2, value3, value4…);

1|Page
NAAF TA’EERA

In addition to that SELECT is also another command used to specify the required data from
the other. So that it is mostly known by calling command.
Syntax;
SELECT * FROM table name;
Or
SELECT column1, coulmn2 …
FROM table name;
Or
SELECT * FROM table name LIMIT row_number;
SELECT DISTINICT also used to return only distinct or different values.
Syntax;
SELECT DISTNICT column1, column2, column3…..
FROM table name;
UPDATE statement: Used to modify the existing records in a table.
Syntax;
UPDATE table name
SET column1=value1, column2=value2…
WHERE condition;

DELETE COMMAND: Used to delete existing records in the table.


Syntax;
mailto:[email protected] June 2023m?subject=efgwqrg

DELETE FROM table name WHERE condition;

CHAPTER TWO

2|Page
NAAF TA’EERA

12 June 2023

3|Page

You might also like