0% found this document useful (0 votes)
28 views2 pages

Comenzi SQL

The document contains SQL statements to create a customers table, alter the table by modifying column properties, rename a column, rename the table, drop the table, perform inserts, updates, deletes, and selects on customer and supplier tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Comenzi SQL

The document contains SQL statements to create a customers table, alter the table by modifying column properties, rename a column, rename the table, drop the table, perform inserts, updates, deletes, and selects on customer and supplier tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE 

TABLE customers
( customer_id number(10) NOT NULL,
customer_name varchar2(50) NOT NULL,
city varchar2(50)
);
 
ALTER TABLE customers
MODIFY customer_name varchar2(100) not null;

ALTER TABLE customers
MODIFY (customer_name varchar2(100) not null,
city varchar2(100));

ALTER TABLE customers
DROP COLUMN customer_name;

ALTER TABLE customers
RENAME COLUMN customer_name to cname;

ALTER TABLE customers
RENAME TO retailers;

DROP TABLE customers;

SELECT age, address, salary
FROM customers
WHERE  age < 25
AND salary > '20000'
ORDER BY age ASC, salary DESC;

INSERT INTO suppliers
(supplier_id, supplier_name)
VALUES
(50, 'Flipkart');

SELECT count(*)
FROM customers
WHERE age > 20;
UPDATE suppliers
SET supplier_name = 'Kingfisher'
WHERE supplier_id = 2;

UPDATE suppliers
SET supplier_address = 'Agra',
supplier_name = 'Bata shoes'
WHERE supplier_id = 1;

DELETE FROM customers
WHERE name = 'Sohan';

DELETE FROM customers
WHERE last_name = 'Maurya'
AND customer_id > 2;

You might also like