Question

11. Consider the following simple database with one table with the following schema: Field | Type Null key | Default | Extra
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Create Trigger Total_Value   //Creates trigger with name Total_value

after Insert,delete,update on Student    //Performs trigger after insert,update and delete operations on student table.

for each row                       //on each and every row in student table

Begin                         //Beginning of Trgger

   insert into Student(total) values(sum(subj1,subj2,subj3)); // Insert the value which is equal to sum of the values of

                                                         // subj1,subj2,subj3 into the total field.

End              //End of the trigger.

    

Add a comment
Know the answer?
Add Answer to:
11. Consider the following simple database with one table with the following schema: Field | Type...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a classrooms table with this definition (try using a multi-line SQL statement): +-----------+-----------------+------+-----+---------+----------------+ | Field...

    Create a classrooms table with this definition (try using a multi-line SQL statement): +-----------+-----------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+-----------------+------+-----+---------+----------------+ | id | int(3) unsigned | NO | PRI | NULL | auto_increment | | room_num | int(4) unsigned | NO | UNI | NULL | | | course_id | int(3) unsigned | YES | MUL | NULL | | +-----------+-----------------+------+-----+---------+----------------+

  • 5. 2. Challenge Defining the reference table A mysql prompt has been opened for you. Using...

    5. 2. Challenge Defining the reference table A mysql prompt has been opened for you. Using the college database, complete the following tasks (use either a single-line or a multi-line SQL statement): Create a courses table with this definition (try using a multi-line SQL statement): +---------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+---------------------+------+-----+---------+----------------+ | id | int(3) unsigned | NO | PRI | NULL | auto_increment | | title | varchar(255) | NO...

  • how does it differ from the white kkdata schema compare to the kkdata6. This is database;...

    how does it differ from the white kkdata schema compare to the kkdata6. This is database; mysgl> describe kkdata6 Field. Nu11 Type work no int (11) YES art first varchar (34) YES art last varchar (34) YES gertitle varchar (79) YES engtitle varchar (79) YES datemonth varchar (9) YES date year varchar (5) YES datetext varchar (60) YES varchar (200) l YES medium dimh varchar (6) YES dimw varchar (6) YES credit varchar (200) YES varchar (77) YES Own name...

  • mysql> DESC shows; +--------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra...

    mysql> DESC shows; +--------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(50) | YES | | NULL | | | network_id | int(11) | YES | | NULL | | | network_name | varchar(30) | YES | | NULL | | +--------------+-------------+------+-----+---------+----------------+ mysql> SELECT * FROM shows; +----+----------------+------------+--------------+ | id | name | network_id | network_name |...

  • Given the bsg_planets table created by using the following definition query : -- CREATE TABLE `bsg_planets`...

    Given the bsg_planets table created by using the following definition query : -- CREATE TABLE `bsg_planets` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `population` bigint(20) DEFAULT NULL, `language` varchar(255) DEFAULT NULL, `capital` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 Insert information about the planet Mars which has a population of 2,  language as "Binary" and "Olympus Mons" as Capital, in bsg_planets. Then list the row(s), with all the information for that...

  • Using MySQL commands answer the questions listed below using the Premier Products Company schema. 1.Using Views...

    Using MySQL commands answer the questions listed below using the Premier Products Company schema. 1.Using Views a) Create a view called part_location that has the following attributes: part_num, part_description, part_quantity, warehouse_name, warehouse_address. This data comes from the part and warehouse entities. b) Write a query using the view that shows the total number of parts ordered from each warehouse. The output should look like this: 2. Using Triggers a) Execute the following SQL to create the customer_audit table in the...

  • create a view vHW1_Q3 with columns (state, population, NumofZipcode) showing the total population and the number...

    create a view vHW1_Q3 with columns (state, population, NumofZipcode) showing the total population and the number of zip code (NumofZipcode) of each state and DC. The result should be sorted by the population size from high to low. The output should have 51 rows. using mysql Questions based on table Zipcode_info in datamining database. 50 US states and one DC means capital washington. these are fields in db +---------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default |...

  • 4 Consider the following relational schema, DDL statements and tables: EMPLOYEE( EmployeeID, EmployeeName, SupervisorID, DepartmentID) PROJECT...

    4 Consider the following relational schema, DDL statements and tables: EMPLOYEE( EmployeeID, EmployeeName, SupervisorID, DepartmentID) PROJECT (ProjectID, EmployeeID) DEPARTMENT( Department ID, DepartmentName) CREATE TABLE EMPLOYEE ( EmployeeID          INT           PRIMARY KEY,    EmployeeName   VARCHAR(50)      NOT NULL,    SupervisorID INT DEFAULT 9,    DepartmentID   INT,    FOREIGN KEY (SupervisorID) REFERENCES EMPLOYEE (EmployeeID)    ON DELETE SET DEFAULT   ),    FOREIGN KEY (DepartmentID) REFERENCES DEPARTMENT(DepartmentID)    ON UPDATE SET NULL); CREATE TABLE PROJECT ( ProjectID    INT          PRIMARY KEY, EmployeeID INT DEFAULT 9, FOREIGN...

  • Query the apartment table and find nearby restaurants with in 200 meters distance. I have two...

    Query the apartment table and find nearby restaurants with in 200 meters distance. I have two tables one gives the home adressses and second has near by businesses with latitude and longitude given. I need to find restaurants nearby the adress with in 200 meters. Each business also has longitude/latitude information, we can get the database to calculate distances to various useful points close by to each apartment. So we have two tables 1. Apartments and no 2 is business....

  • Consider the computer science bibliography domain described in Lab Assignment 1. Consider the schema in Figure...

    Consider the computer science bibliography domain described in Lab Assignment 1. Consider the schema in Figure to model this domai Each author in table Authors is identified by a unique authorID which is autogenerated. Each author has a first name, a last name and an email. The email is unique, while the first name and last name may not be unique. Each paper is identified by a unique papeD which is autogenerated. For each paper, we keep in table Papers...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT