Question

Create a trigger in SQL that checks to make sure that the user enters a phone...

Create a trigger in SQL that checks to make sure that the user enters a phone number while creating their account.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

check this:

ctreate a bolean called bphone.

whenever a new phone number is added change this flag to true.

in validate check add the new phone number and then reset the bphone flagto 0 using a trigger called phone_trigger.

alter table employee add bphone default false;

CREATE FUNCTION validate()

RETURNS trigger as'

            IF NEW.bphone THEN

                  NEW.phonerec=NEW.phonerec;

                  NEW.bphone=FLASE;

            END IF;

            return NEW;

END ' language 'plpgsql';

then,

create trigger phone_trigger

before update on employee

      for each row

     execute procedure validate();

hope this helps.

regards.

Add a comment
Know the answer?
Add Answer to:
Create a trigger in SQL that checks to make sure that the user enters a phone...
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
  • MUST BE IN MICROSOFT SQL SERVER MANAGEMENT STUDIO !!* CODING Create a trigger named Products_UPDATE that...

    MUST BE IN MICROSOFT SQL SERVER MANAGEMENT STUDIO !!* CODING Create a trigger named Products_UPDATE that checks the new value for the DiscountPercent column of the Products table. This trigger should raise an appropriate error if the discount percent is greater than 100 or less than 0. If the new discount percent is between 0 and 1, this trigger should modify the new discount percent by multiplying it by 100. That way, a discount percent of .2 becomes 20. Test...

  • Create an application where a user can make a phone book such as name, email address,...

    Create an application where a user can make a phone book such as name, email address, phone number.....etc

  • PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create...

    PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create the schema, and package. 2. Create users x1 and x2 who are the participants in the auction. They will need acces to the package. 3. Bid on the same item and record your observations. Verify all scenarios. Upload the files with the missing code and a detailed sample run. AUCTION OWNER.TXT SQL> conn / as sysdba Connected. SQL> drop user xyz cascade; User dropped....

  • Python Create a function that checks user input in an attempt to create a password. The...

    Python Create a function that checks user input in an attempt to create a password. The valid_password function accepts a password as an argument and returns either true or false to indicate whether the password is valid. A valid password must be at least 7 characters in length, have at least one uppercase letter, one lowercase letter, and one digit. Respond with output to the user as to whether the password is valid or not, and allow the user to...

  • SQL Triggers: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named...

    SQL Triggers: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named trg prod QOH_on_line_update that will automatically update the product quantity on hand for a product when a corresponding product LINE row is updated. A template has been created for you below for this trigger. Fill in the ... areas with the proper code: CREATE OR REPLACE TRIGGER trg prod_QOH_on_line_update BEFORE UPDATE ON LINE FOR EACH ROW BEGIN UPDATE SET WHERE END; COMMIT;

  • Use an INSERT INTO statement with a subquery containing a SQL string function to create user...

    Use an INSERT INTO statement with a subquery containing a SQL string function to create user names for the volunteers based on their legal names and insert them into the table. +----------------------+ | Tables_in_volunteers | +----------------------+ | address              | | email                | | funds                | | hours                | | person               | | phone                | | users                | +----------------------+ users legal names are in the address table user table is : CREATE TABLE USERS(volunteer_id INT NOT NULL, username VARCHAR(50), PRIMARY KEY...

  • SQL Triggers: PESOFT P NOTE POO IS DOCE ESTE GIS DAN DISINI OS ARRANCE US PHONE...

    SQL Triggers: PESOFT P NOTE POO IS DOCE ESTE GIS DAN DISINI OS ARRANCE US PHONE QUS BALANCE WOO PARCE P DISCOUNT V OGLE VALE VONTACT VAREATCOS VEMONE V SAE VORCER SED IN DATE P ORDE UNE UNITS UPER BP NE BPNTAL PP 14 DATE VENTA DE BP VOR Create a trigger called named trg_prod QOH_on_line_add that will automatically update the product quantity on hand for a product when a corresponding product LINE row is added. We end a trigger...

  • create table sql query and insert data sql query for the below - VehicleType(make, model, doors,...

    create table sql query and insert data sql query for the below - VehicleType(make, model, doors, body,trim) Vehicle(regNum, fleetNum, colour, make,model) ScheduledService(date,kilometrage,regNum,depotId) ServiceHistory(date,cost,description,regNum,depotId) Records(make,model,tariffId,rentalPrice) DailyTariff(tariffId, conditions) Invoice(invoiceId,qualityCheck,datePaid,finalCost,date) Insurance(insuranceId, policyType, cost) Insures(insuranceId,date,policyNumber) HiredVehicle(date, cardType, cardNo, kilometrage, days,tariffId,clientId,depotId,regNum) Depot(depotId, street,postcode,phone,fax) Booking(startDate,hiredays,colour,depotId,make,model,clientId) Client(clientId,street,postcode,phone) PersonalClient(clientId, fName, lName, title, driversNum) CompanyClient(clientID, cname) underlined are primary keys and italicised are foreign keys.

  • Using arrays create a personal phone directory that contains room for first names and phone numbers...

    Using arrays create a personal phone directory that contains room for first names and phone numbers for 20 people. Using the "names.txt" retrieve the first name and phone number for each person and store in arrays (parallel). Prompt the user for a name, search for the name, and if name is found in the array, display the corresponding phone number. If the name is not found, prompt the user to enter a phone number, and add the new name and...

  • how to make SQL CREATE TABLE in Microsoft Access? how to make SQL INSERT in Microsoft...

    how to make SQL CREATE TABLE in Microsoft Access? how to make SQL INSERT in Microsoft access? please answer by giving step by step

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