update
This commit is contained in:
@@ -1,6 +1,47 @@
|
||||
create table if not exists stores
|
||||
(
|
||||
street varchar(100),
|
||||
street varchar(100) NOT NULL,
|
||||
description text
|
||||
)
|
||||
);
|
||||
|
||||
alter table stores
|
||||
add column name varchar(100);
|
||||
|
||||
alter table stores
|
||||
drop column name;
|
||||
|
||||
alter table stores
|
||||
add column name varchar(100) first; # Bei MySQL gibt es kein BEFORE, es gibt nur AFTER und FIRST
|
||||
|
||||
alter table stores
|
||||
modify column name varchar(100);
|
||||
|
||||
alter table stores
|
||||
add column city varchar(100) after street;
|
||||
|
||||
alter table stores
|
||||
add column rent decimal(8, 2);
|
||||
|
||||
alter table stores
|
||||
add column num_sales int unsigned; # Unsigned (nur positive Zahlen)
|
||||
|
||||
INSERT INTO stores (street, city, description, rent, num_sales)
|
||||
VALUES ('123 Main St', 'New York', 'Spacious 2-bedroom apartment in the heart of downtown.', 2500.00, 5),
|
||||
('456 Elm St', 'Los Angeles', 'Modern loft with great city views and natural light.', 3200.50, 3),
|
||||
('789 Pine Ave', 'Chicago', 'Cozy studio close to public transport and shopping.', 1800.75, 7),
|
||||
('101 Maple Rd', 'San Francisco', 'Luxury penthouse with rooftop access and premium amenities.', 5500.00, 2),
|
||||
('202 Oak St', 'Miami', 'Beachfront condo with private balcony and ocean views.', 4200.25, 4);
|
||||
|
||||
create table if not exists users
|
||||
(
|
||||
id int primary key auto_increment,
|
||||
email varchar(100) not null,
|
||||
password varchar(100) not null,
|
||||
created_at timestamp default current_timestamp
|
||||
);
|
||||
|
||||
insert into users (email, password)
|
||||
values ('test@test.de', '123456');
|
||||
|
||||
alter table users
|
||||
add column num_books int not null default 0;
|
Reference in New Issue
Block a user