Userid to write DDL statement to create the following table

Userid to write DDL statement to create the following table named as hw2tusers. world, will be the primary key (notice that it is underlined to meant to be the primary key) should not be null, the default value of status should be i. (In real the password field should be encrypted, but we use plain password to mainly database problems.) illustrate status name(varchar2(10)) (number) use 555555 Kelly 333333 Kelly 2. (4 points) write DML SQL statements to insert above records into the above table populate the table) 3. (4 points) Write a single DML SQL statement to update status to 2 for all records. 4. (4 points) write a DMI sQLstatement to update the user2 record\'sname to kerly by matching user2 with uscrid in the where subclause. 5. (4 points) Write a DML SQL statement to delete user4 record. 6. points) You need to create a second table, called hw2tlogevents, which keeps tracking of the time spans during which each user has logged on to the system. create the following table first, do not populate data, for you are going to populate this table in a new way. Note that the first column eventide serves as the primary key for second table, and the userid serves as the foreign key to the table. attacking this problem, you will study how to use key to connect the relate userid to the userid from the previous table. hw2tlog events eventidinumbero userid(varchar2(10) timespan (number) User1 500 88 600

Solution

1)create table hw2tuser(userid varchar2(10) primary key,password varchar2(10), status number, name varchar2(10));

2)

INSERT INTO hw2tuser VALUES (user1,66666,1,john);

INSERT INTO hw2tuser VALUES (user2,55555,1,Kelly);

INSERT INTO hw2tuser VALUES (user3,44444,1,james);

INSERT INTO hw2tuser VALUES (user4,33333,1,Kelly);

3) UPDATE hw2tuser SET status= 2;

4) UPDATE hw2tuser SET name=\'kerly\' WHERE userid=user2;

5) DELETE FROM hw2tuser WHERE userid=user4;

6)create table hw2tlogevents(eventid number primary key,userid varchar2(10), timespan number);

8)select distinct name from hw2tuser union select distinct name from hw2tlogevents ;

9)select name from hw2tuser union hw2tlogevents where name LIKE \'j%\' ;

10)SELECT * FROM hw2tuser ORDER BY name;

11)SELECT eventid,name,timespan FROM hw2tuser , hw2tlogevents WHERE userid = userid ;

12)SELECT name,timespan FROM hw2tuser , hw2tlogevents WHERE userid = userid ORDER BY timespan ;

13)SELECT name,tota_logging_numbers FROM hw2tuser , hw2tlogevents WHERE userid= userid ORDER BY tota_logging_numbers DESC;

 Userid to write DDL statement to create the following table named as hw2tusers. world, will be the primary key (notice that it is underlined to meant to be the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site