Welcome on my blog

We use cookies to ensure you get the best experience on our website.

Mysql Simple / Sample Database and Tables

Autor: chmajster 19.01.2024

Tworzenie Bazy, Tabeli, Rekordow

-- Create a new database with "chris" appended
CREATE DATABASE IF NOT EXISTS sample_db_chris;

-- Switch to the new database
USE sample_db_chris;

-- Create a table within the database with extended columns
CREATE TABLE IF NOT EXISTS sample_table (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(50),
    age INT,
    email VARCHAR(50),
    address VARCHAR(100)
);

-- Insert 10 rows of data into the table
INSERT INTO sample_table (name, age, email, address) VALUES
('John', 25, 'john@example.com', '123 Main St'),
('Jane', 30, 'jane@example.com', '456 Oak St'),
('Bob', 22, 'bob@example.com', '789 Elm St'),
('Alice', 28, 'alice@example.com', '101 Pine St'),
('Charlie', 35, 'charlie@example.com', '202 Maple St'),
('Eva', 27, 'eva@example.com', '303 Birch St'),
('David', 32, 'david@example.com', '404 Cedar St'),
('Sophie', 29, 'sophie@example.com', '505 Spruce St'),
('Michael', 40, 'michael@example.com', '606 Fir St'),
('Olivia', 26, 'olivia@example.com', '707 Redwood St');

Test

-- Switch to the database
USE sample_db_chris;

-- Select all rows from the table
SELECT * FROM sample_table;
Tagi:
Dodaj komentarz

Search
Categories
O Blogu

Cześć Podróżniku!

Ta strona ma nie być typowym poradnikiem w IT, Głównym jej cel to zapisanie krótkich notatek, które mogą się przydać w codziennym życiu podczas korzystania/konfiguracji różnych urządzeń np. Ustawienia DHCP na Routerze Cisco, Ustawieniu Karty sieciowej na Linuxie itp.

Buy me A coffee
[Empty]

Wszelkie prawa zastrzeżone