Advertisement
vvccs

ADS_4_Sequence_synonyms

Oct 15th, 2024 (edited)
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.54 KB | None | 0 0
  1. ORACLE
  2.  
  3. CREATE TABLE students (
  4.  student_id NUMBER PRIMARY KEY,
  5.  first_name VARCHAR2(50),
  6.  last_name VARCHAR2(50),
  7.  email VARCHAR2(100)
  8. );
  9. CREATE SEQUENCE student_seq
  10. START WITH 1
  11. INCREMENT BY 1
  12. CACHE 20;
  13. INSERT INTO students (student_id, first_name, last_name, email)
  14. VALUES (student_seq.NEXTVAL, 'Alice', 'Johnson', 'alice.johnson@example.com');
  15. INSERT INTO students (student_id, first_name, last_name, email)
  16. VALUES (student_seq.NEXTVAL, 'Bob', 'Smith', 'bob.smith@example.com');
  17. CREATE SYNONYM stu FOR students;
  18. SELECT * FROM stu;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement