MySQL Befehle

Create database with UTF-8 charset which is case-insensitive (_ci) and use that database

CREATE DATABASE `DB_NAME` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `DB_NAME`;

Insert data

-- Iteration 1
INSERT INTO `USERS`(`ID`, `PRENAME`, `SURNAME`) 
VALUES (1, 'Benny', 'Neugebauer');
 
INSERT INTO `USERS`(`ID`, `PRENAME`, `SURNAME`) 
VALUES (2, 'Michael', 'Koppen');
 
-- Iteration 2
INSERT INTO `USERS`(`ID`, `PRENAME`, `SURNAME`) VALUES 
(1, 'Benny', 'Neugebauer'),
(2, 'Michael', 'Koppen');
 
-- Iteration 3
INSERT INTO USERS(ID, PRENAME, SURNAME) VALUES 
(1, 'Benny', 'Neugebauer'),
(2, 'Michael', 'Koppen');

Give user ‚root‘ access to all databases and tables (*.*) from every host (%)

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Add column after another column

ALTER TABLE `VIDEO` ADD `ENABLED` BOOLEAN NOT NULL AFTER `DESCRIPTION`;

Remove column

ALTER TABLE `video` DROP `ENABLED`;

Clear table

TRUNCATE TABLE `VIDEO`;

Kommentar abgeben

Microsoft Certified Professional Logo
 

Werbung


+Benny Neugebauer