Documente Academic
Documente Profesional
Documente Cultură
.5Hrs Read the Submission section in the last page before starting the assignment.
Pre-Requirements: Oracle 10g Express Edition should be installed on the students local computer. SYSTEM users password is to be informed by the instructor during the lab session/assignment. Use Application express web interface to login and continue by directing the web browser to http://127.0.0.1:8080/apex/
Part 1: Creating User Accounts Create two user accounts. One account to be created with admin privileges. Go to application express web interface and login with system user. Administration -> Database Users -> Create User -> Add your name to user name (eg: ransara). In user privileges area, select DBA role. (Adding to newly created user to DBA role) Create. Logout and login again using the above created account (ie: ransara). Create second user account (name as app) similarly without adding the DBA role.
Checking your users in oracles users table. GoTo Apex -> SQL -> Create -> SQL Commands -> Enter Command
SUBMISSION: ANSWER 1 Export the query results to a csv file, open the csv file with a text editor, copy and paste it in your answers document.
Part 2: Creating student table. Login with your admin account (ie: account in your name, eg: rans, with DBA privileges) Step 1: Create STUDENT table, with columns: id, regNo, name, dob, gender, nic and address id is the primary key, a number up to 10 digits. regNo contains a string. gender contain only M and F values. GoTo Apex -> Object Browser -> Create -> Table
Step 2: Set id as the primary key, which is an auto incrementing number sequence.
Step 3: No foreign key for this table. Step 4: Add a unique constraint to RegNo field (unique constrain on student to ensure RegNo is not repeated).
Step 5: Add another constraint to make sure that gender contain only M and F letters.
SUBMISSION: ANSWER 2
Part 3: Insert student details to the STUDENT table. Insert data by entering SQL command. GoTo Apex -> SQL -> SQL Commands -> Enter command Eg: INSERT INTO STUDENT VALUES(10, '054099J', 'Ransara', '12-Apr-1985', 'M'); Note: although id is here, it will not be in the table, id is assigned by the dbms.
You can enable auto commit. Note: Oracle supports AUTOCOMMIT option. With this option set to ON each individual SQL statement is treated as a transaction and its automatically commited right after it is executed. Users can change the AUTOCOMMIT option by executing command SET AUTOCOMMIT ON or OFF Enter some students:
Part 4: Check constraints are working Enter another student with same RegNo and check the result. Enter another with gender a to check that the CHECK constraint is working. SUBMISSION: ANSWER 3 Copy and paste the query and result (only the text, not the screen captures).
Submission: All answers (Answer 1, 2 and 3) should contain in one .doc document. The name of the (MS Word) document should be IT3802_AS1_<index_number>.doc (eg: IT3802_AS1_054099.doc) Email title should be [IT3802][AS_01_LAB][<YourIndexNumber>] Eg: [IT3802][AS_01_LAB][054099] Mail to ransaraw@gmail.com Submission (emailing) has to be done at the end of lab session. Late submissions will not gain full marks. Note: 1. 2. 3. 4. The subject/title of the email should be correct. The document name should be correct. If two assignments seem to be identical, then none will be given marks. Emails with incorrect subjects will not gain any marks.