Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet440/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   436   437   438   439   440   441   442   443   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

[
 340 
]
Now, let's go back to databases. Now that we've created the 
mysampledb
 database, 
what can we do with it? We'll add tables and rows, of course! A database is useless 
without actual data, so we can work through some examples of adding data to our 
database to see how this works. First, log in to the MariaDB shell as a user with full 
privileges to the 
mysampledb
 database. Now, we can have some fun and modify the 
contents. Here are some examples you can follow:
USE mysampledb;
The 
USE
 command allows us to select a database we want to work with. The MariaDB 
prompt will change from 
MariaDB [(none)]>
 to 
MariaDB [mysampledb]>
. This is very 
useful, as the MariaDB prompt changes to indicate which database we are currently 
working with. We basically just told 
MariaDB
 that for all of the commands we're 
about to execute, we would like them used against the 
mysampledb
 database.
Now, we can 
CREATE
 a table in our database. It doesn't matter what you call yours, 
since we're just practicing. I'll call mine 
Employees
:
CREATE TABLE Employees (Name char(15), Age int(3), Occupation 
char(15));
We can verify this command by showing the columns in the database, to ensure it 
shows what we expect:
SHOW COLUMNS IN Employees;
With this command, we've created a table named 
Employees
 that has three columns 
(
Name

Age
, and 
Occupation
). To add new data to this table, we can use the following 
INSERT
 command:
INSERT INTO Employees VALUES ('Joe Smith', '26', 'Ninja');
The example 
INSERT
 command adds a new employee to our 
Employees
 table. When 
we use 
INSERT
, we insert all the data for each of the columns. Here, we have an 
employee named 
Joe
, who is 
26
 years old and whose occupation is a 
Ninja
. Feel 
free to add additional employees; all you would need to do is formulate additional 
INSERT
 statements and provide data for each of the three fields. When you're done, 
you can use the following command to show all of the data in this table:
SELECT * FROM Employees;


Chapter 13

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   436   437   438   439   440   441   442   443   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish