Advertisement
vvccs

ADS_1_DML_DDL

Oct 15th, 2024 (edited)
197
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.70 KB | None | 0 0
  1. ORACLE
  2. use db;
  3. show databases;
  4.  
  5. CREATE TABLE Customer(
  6.   CustomerID INT,
  7.   CustomerName VARCHAR(50),
  8.   LastName VARCHAR(50),
  9.   Country VARCHAR(50),
  10.   Age INT,
  11.   Phone VARCHAR(15)
  12. );
  13.  
  14. DROP TABLE Customer;
  15. DESCRIBE Customer;
  16. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  17. VALUES (1001, 'John', 'Doe', 'USA', 25, '9876543210');
  18.  
  19. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  20. VALUES (1002, 'Jane', 'Doe', 'USA', 28, '1234567890');
  21.  
  22. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  23. VALUES (1003, 'Alice', 'Johnson', 'Canada', 29, '0987654321');
  24.  
  25. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  26. VALUES (1004, 'Bob', 'Smith', 'UK', 32, '4567891234');
  27.  
  28. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  29. VALUES (1005, 'Charlie', 'Brown', 'Australia', 22, '6543210987');
  30.  
  31. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  32. VALUES (1006, 'David', 'Taylor', 'Germany', 30, '7894561230');
  33.  
  34. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  35. VALUES (1007, 'Emily', 'Davis', 'France', 27, '3216549870');
  36.  
  37. INSERT INTO Customer(CustomerID, CustomerName, LastName, Country, Age, Phone)
  38. VALUES (1008, 'Fiona', 'Williams', 'Italy', 35, '1478523690');
  39.  
  40. SELECT * FROM Customer;
  41. DELETE FROM Customer WHERE CUSTOMERID= 1005;
  42. UPDATE Customer SET CUSTOMERNAME= 'Fiona' WHERE CUSTOMERID= 1008;
  43.  
  44. ALTER TABLE Customer RENAME TO CustInfo;
  45.  
  46. CREATE USER user123 IDENTIFIED BY your_password;
  47. GRANT CREATE SESSION TO user123;
  48. GRANT SELECT, INSERT ON CustInfo TO user123;
  49.  
  50. REVOKE INSERT ON CustInfo FROM user123;
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement