added tasks 0 to 1
This commit is contained in:
parent
b6d7709903
commit
03acb1a531
|
@ -0,0 +1,29 @@
|
||||||
|
-- Active: 1697184303960@@127.0.0.1@3306
|
||||||
|
|
||||||
|
# Date: 13.10.2023
|
||||||
|
# Author: Sven Vogel
|
||||||
|
|
||||||
|
# ---------------------------------------------
|
||||||
|
# setup database schema
|
||||||
|
CREATE SCHEMA IF NOT EXISTS task01;
|
||||||
|
USE task01;
|
||||||
|
|
||||||
|
# select a single number
|
||||||
|
SELECT 5 AS number;
|
||||||
|
# interpret value as hex
|
||||||
|
SELECT hex(255) AS hexnum;
|
||||||
|
|
||||||
|
# intger encode of ascii '5'
|
||||||
|
SELECT ASCII('5');
|
||||||
|
SELECT BIN(65);
|
||||||
|
# binary value of 'A'
|
||||||
|
SELECT BIN(ASCII('A'));
|
||||||
|
# binary encode of 'Mucke'
|
||||||
|
SELECT CONCAT_WS(
|
||||||
|
' ',
|
||||||
|
BIN(ASCII('M')),
|
||||||
|
BIN(ASCII('u')),
|
||||||
|
BIN(ASCII('c')),
|
||||||
|
BIN(ASCII('k')),
|
||||||
|
BIN(ASCII('e'))
|
||||||
|
);
|
|
@ -0,0 +1,24 @@
|
||||||
|
-- Active: 1697184303960@@127.0.0.1@3306
|
||||||
|
CREATE SCHEMA IF NOT EXISTS task02;
|
||||||
|
USE task02;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS fruits;
|
||||||
|
|
||||||
|
CREATE TABLE fruits (
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
name VARCHAR(45) NOT NULL,
|
||||||
|
color VARCHAR(10)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO fruits (name, color) VALUES ('Banane', 'gelb');
|
||||||
|
INSERT INTO fruits (name, color) VALUES ('Kiwi', 'grün');
|
||||||
|
INSERT INTO fruits (name, color) VALUES ('Apfel', 'grün');
|
||||||
|
INSERT INTO fruits (name, color) VALUES ('Apfel', 'rot');
|
||||||
|
INSERT INTO fruits (name, color) VALUES ('Erdbeere', 'rot');
|
||||||
|
INSERT INTO fruits (name, color) VALUES ('Himbeere', 'rot');
|
||||||
|
INSERT INTO fruits (name, color) VALUES ('Birne', 'grun');
|
||||||
|
|
||||||
|
SELECT * FROM fruits;
|
||||||
|
SELECT name FROM fruits WHERE color = 'rot';
|
||||||
|
SELECT name FROM fruits;
|
||||||
|
SELECT DISTINCT name FROM fruits;
|
Loading…
Reference in New Issue