Question

1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....

1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables.

2. Write a script that (1) creates a login ID named “RobertHalliday” with the password “HelloBob”; (2) sets the default database for the login to the MyGuitarShop database; (3) creates a user named “RobertHalliday” for the login; and (4) assigns the user to the OrderEntry role you created in exercise 1.

3. Write a script that uses dynamic SQL and a cursor to loop through each row of the Administrators table and (1) create a login ID for each row in that consists of the administrator’s first and last name with no space between; (2) set a temporary password of “temp” for each login; (3) set the default database for the login to the MyGuitarShop database; (4) create a user for the login with the same name as the login; and (4) assign the user to the OrderEntry role you created in exercise 1.

4. Using the Management Studio, create a login ID named “RBrautigan” with the password “RBra9999,” and set the default database to the MyGuitarShop database. Then, grant the login ID access to the MyGuitarShop database, create a user for the login ID named “RBrautigan”, and assign the user to the OrderEntry role you created in exercise 1. Note: If you get an error that says “The MUST_CHANGE option is not supported”, you can deselect the “Enforce password policy” option for the login ID.

5. Write a script that removes the user-defined database role named OrderEntry. (Hint: This script should begin by removing all users from this role.)

6. Write a script that (1) creates a schema named Admin, (2) transfers the table named Addresses from the dbo schema to the Admin schema, (3) assigns the Admin schema as the default schema for the user named RobertHalliday that you created in exercise 2, and (4) grants all standard privileges except for REFERENCES and ALTER to RobertHalliday for the Admin schema.

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

CREATE DATABASE MyGuitarShop ;/* Creates a new database called MyGuitarShop */

USE MyGuitarShop ;/* To use MyGuitarshop as the current database */

CREATE ROLE OrderEntry ;/* Creates a new role called OrderEntry */

GRANT INSERT ON Orders ,OrderItems TO OrderEntry ;/* Grant Insert permission to the Role "OrderEntry " for the tables Orders ,OrderItems */

GRANT UPDATE ON Orders ,OrderItems TO OrderEntry ;/* Grant update permission to the Role "OrderEntry " for the tables Orders ,OrderItems */

GRANT SELECT ON Orders ,OrderItems TO ALL;/* Gives select permission on to all user tables*/

Add a comment
Know the answer?
Add Answer to:
1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....
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
  • 1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....

    1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 3) Write a script that uses dynamic SQL and a cursor to loop through each row of the Administrators table and (1) create a login ID for each row in that consists of the administrator�s first and last name with no space...

  • Write a PHP script that obtains a URL and its description from user and stores the...

    Write a PHP script that obtains a URL and its description from user and stores the information into a database using MySQL. Create and run a SQL script with database named URL and a table named Urltable. The first field of the table should contain an actual URL, and the second, which is named Description, should contain a description of the URL. Use www.deitel.com as the first URL, and input Cool site! as its description. The second URL should be...

  • 2. Write a script that implements the following design: In the Downloads table, the user_id and...

    2. Write a script that implements the following design: In the Downloads table, the user_id and product_id columns are the foreign keys. Create these tables in the ex schema. Create the sequences for the user_id, download_id, and product_id columns. Include a PL/SQL script to drop the table or sequence if it already exists. Include any indexes that you think are necessary. 3. Write a script that adds rows to the database that you created in exercise 2. Add two rows...

  • Programming Exercise 4.9 Write a script named numberlines.py. This script creates a program listing from a...

    Programming Exercise 4.9 Write a script named numberlines.py. This script creates a program listing from a source program. This script should: Prompt the user for the names of two files. The input filename could be the name of the script itself, but be careful to use a different output filename! The script copies the lines of text from the input file to the output file, numbering each line as it goes. The line numbers should be right-justified in 4 columns,...

  • 3. Write a script that adds rows to the database that you created in exercise 2....

    3. Write a script that adds rows to the database that you created in exercise 2. Add two rows to the Users and Products tables. Add three rows to the Downloads table: one row for user 1 and product 2; one row for user 2 and product 1; and one row for user 2 and product 2. Use the SYSDATE function to insert the current date into the download_date column. Use the sequences created in the previous exercise to get...

  • 1. Write the php statements to connect to MySQL server and select the database named personnel....

    1. Write the php statements to connect to MySQL server and select the database named personnel. The database personnel is located at localhost server. The user id and password to log on to the server are finalexam and thePassword respectively. 2. Using the above connection, write the php statements to retrieve the name and the email fields from all records of the users table ( 'SELECT name, email FROM users') and display them one record per line.

  • I need help creating a netbeans application and linking database with steps Part II – Next,...

    I need help creating a netbeans application and linking database with steps Part II – Next, build a simple Servlet called LoginServlet in your “Bank” Project. Now make it so that when the Customer logs in, the LoginServlet will get called and will validate the user id and password. At first, just make sure that the Servlet gets called correctly. So just print a simple message like “LoginServlet Running…”. Remember, to call the LoginServlet, you will need to modify the...

  • Write a bash script to protect a directory. Your script should notify a user of the...

    Write a bash script to protect a directory. Your script should notify a user of the following: -New file was created -Permission changes -Ownership changes -File size changes -Modification date changes Your script should have two operation modes, protect and check. Use command line flags, -p <directory> and -c <directory> to decide which mode to operate in. In protect mode, your script should create a file called .protect inside the directory you want to watch. You will use this file...

  • Function / File Read (USING MATLAB) A) create a user-defined function : [maxsample , maxvalue , numsamples]=writetofile(sname,strgth) to do the following: The user-defined function shall: -Accept as t...

    Function / File Read (USING MATLAB) A) create a user-defined function : [maxsample , maxvalue , numsamples]=writetofile(sname,strgth) to do the following: The user-defined function shall: -Accept as the input a provided string for the sample name (sname) and number for strength (strgth) - open a text file named mytensiledata.txt, with permission to read or append the file. - Make sure to capture any error in opening the file - Write sname and strgth to the file - Close the file...

  • Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row...

    Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table. This stored procedure should accept five parameters. One parameter for each of these columns: CategoryID, ProductCode, ProductName, ListPrice, and DiscountPercent. This stored procedure should set the Description column to an empty string, and it should set the DateAdded column to the current date. If the value for the ListPrice column is a negative number, the stored procedure should raise an...

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