create a table with the below specification:
Table name: Accounts
columns names :
account_id number(5), ( no duplicates or null values allowed)
account_type varchar(20) ,It can have only 2 types(SAVINGS) , create a check constraint name as chk_act_type to do that
join_date date , sysdate should be automatically inserted if not specified( use a constraint)
inital_deposit number(10), mininum of rs.10000 should be deposited,( use a constraint) constraint name as chk_intdepo
After creating the table, do the following
2. Add a not null constraint to contactno.
3. Add a check constraint to location and it should be (NORTH,EAST,WEST,SOUTH).
4. Modify the Account_type to have two options (SAVINGS and CURRENT).
insert 5 records with the below values.
6. Check how many constraints are there in ACCOUNTs table. Also, specify its type.
7. Check which columns have constraints
8. How many indexes are there for this table.
Create a table TXN with following columns
column name :
txn_date date, without null
txn_type varchar2(10)(DEPOSIT/WITHDRAWL) -> use check constraint
after creating the table.
Add a foreign key for the TXN table referencing accounts(account_id)
10. Check how many constraints are there in ACCOUNTs/TXN table. Also, specify its type.
11. Check which columns have constraints on both tables
12. How many indexes are there for this table on both tables
insert below records. If you get any errors, specify the reason why you were not able to do it and fix it.
14. delete a record from accounts with accountid=1
15. delete account_id=2 from accounts , and make sure that the records from TXN also deletes automatically. (use on delete cascade)
16. Disable all the constraints for accounts and txn( create a alter script for that)
insert below records
18. Enable all the constraints for accounts and txn (without validating it)( create a alter script for that)
19. Check how many constraints are there in ACCOUNTs/TXN table. Also, specify its type
20. Check which columns have constraints on both tables