Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
create table products( id int auto_increment primary key, nae varchar(40), price decimal(5,2)); insert into products( id, nae, price) values( 100, "shamna", 566.00); insert into products( id, price) values (101, 678.00); insert into products(nae) values("expresso"); Alter table products change nae name varchar(40); update products set price = 345.00 where id= 102; update products set name= "cappucino" where id = 101; update products set name= "americano" where id = 100; create table customers( id int auto_increment primary key, first_name varchar(40), last_name varchar(40), gender enum( 'M', 'F'), phone bigint); insert into customers(id, first_name, last_name, gender, phone) values( 100, "Aahila", "Mehza", 'F', 9090900990); insert into customers(id, first_name, last_name, gender, phone) values( 102, "Ashmia", "Mehzia",'F', 9090340990), (103, "Shafein", "hikan", 'M', 1234567898), (104, "Arun", "Saji", 'M', 2345678912); create table orders(id int auto_increment primary key, product_id int, customer_id int, order_time datetime, foreign key (product_id) references products(id), foreign key (customer_id) references customers(id)); INSERT INTO orders (product_id, customer_id, order_time) VALUES (100, 100, '2025-05-07 14:30:00'),(101, 102, '2025-03-21 14:10:10'), (102, 103, '2025-05-01 12:34:12'); select * from products; select * from customers; select * from orders; Alter table products add column coffee varchar(40); Alter table products change column coffee coffee_Origin varchar(45); update products set coffee_Origin = "Russia" where id = 100; update products set coffee_Origin = "America" where id = 101; update products set coffee_Origin = "India" where id = 102; alter table products drop column coffee_Origin; select * from products; create table test(id int auto_increment primary key, name varchar(40), age int); select * from test; drop table test; create table test(id int auto_increment primary key, name varchar(40), age int); insert into test(id, name, age) values(1000,"Safar",29), (2000, "Ayshath", 39), (3000,"Shamnad", 45); select * from test; truncate table test; select * from test;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear