Question

Create a user-defined function in SQL to return a valid query author and date. This will...

Create a user-defined function in SQL to return a valid query author and date. This will be used for all views later on in future queries.

Homework Answers

Answer #1

Solution:

Hi, your question seems to be incomplete. You have not specififed the table and its attributes. Also, what's the input for the function.

Based on what you have provided, the function will have the following structure:

create function dbo.udf_get_author_and_date()
returns table
as
return
(
select [AuthorName] ,[Date]
from [Books]
where (your condition)
)

-------------------------------------------------------------------------------------------------

CREATE FUNCTION = is used to create the user defined function in SQL.

dbo.udf_get_author_and_date() is the function name

returns table = function returns the table data type

within function, specify your query. If no condition, remove the where clause.

----------------------------------------------------------------------------------------------------

Know the answer?
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
Similar Questions
Create Function in (PL/SQL) called lookup_user (v_email) Return the user number of the given user or...
Create Function in (PL/SQL) called lookup_user (v_email) Return the user number of the given user or -1 if the user is not found. Table Account (this is the table I need to add data using Function) Account_no (PK) Email (VARCHAR2) first (VARCHAR2) last (VARCHAR2)
First issue: a) I am trying to create a SQL query so i can list all...
First issue: a) I am trying to create a SQL query so i can list all the items that a user has bought b)I am trying to show how much it will cost in total for user My tables: Table user(user_id, username, shipping_address) Table item(item_id, item, pricing) Table receipt(r_id, user_id, date_current) Table rDetailing(r_id, item_id, item_in, amount_of_item)
Create an SQL query for the following: Show all fields of any records with Express Air...
Create an SQL query for the following: Show all fields of any records with Express Air as ShipMode if the OrderPriority is either high or critical. All of these fields are in a table names Invoices.
PS8 JULY 1. Log on to your Oracle ApEx account. Navigate to SQL Workshop à SQL...
PS8 JULY 1. Log on to your Oracle ApEx account. Navigate to SQL Workshop à SQL Scripts Create a SQL script called update_demo_orders that contains these update statements: update demo_orders set order_total = 200 where customer_id = 1; update demo_orders set order_total = 15 where customer_id = 2; update demo_orders set order_total = 12 where customer_id = 3; update demo_orders set order_total = 22 where customer_id = 4; update demo_orders set order_total = 32 where customer_id = 5; update demo_orders...
Write a C++ program with a user-defined function myFactorial, that calculates the factorial of a number...
Write a C++ program with a user-defined function myFactorial, that calculates the factorial of a number entered by the user. Return the calculated factorial and print it in the main function.
**C code only In this part, you will write a simple user-defined function that prints a...
**C code only In this part, you will write a simple user-defined function that prints a message. This function does not require any parameters or return value. The purpose is simply to get you started writing functions.Open repl project Lab: User-Defined Functions 1. Write a program that calls a function. This function should do the following: 1.Ask the user their name 2. Print a "hello" message that includes the user's name Example output: Please enter your name: ​Mat Hello, Mat!...
PLEASE USE MICROSOFT SQL SERVER MANAGEMENT STUDIO 18 The purpose of this task is to create...
PLEASE USE MICROSOFT SQL SERVER MANAGEMENT STUDIO 18 The purpose of this task is to create a student table such that it has 2 partitions. One that will include all student id's through 500 and a second one that will include all student id's above 500. StudentID                   int           StudentName              varchar(30) *StudentID should be a a primary key. **StudentName should be required. Do you not use the master filegroup. Each partition should be associated with a different physical file. Use any...
You have to create a Library Borrowing System based on the following requirements: When new books...
You have to create a Library Borrowing System based on the following requirements: When new books arrive, these books must be cataloged into the system by a librarian (i.e., entered in the system). Information on a book should include book ID, title, author ID, ISBN, and edition. The system should capture author names so that users can search for an author. The library may carry multiple books by the same author, and an author can have multiple books in the...
A. Write C code to create a structure called time_of_day, which stores the current time in...
A. Write C code to create a structure called time_of_day, which stores the current time in hours, minutes, and seconds. All the fields should be integers except for seconds, which should be a floating point value. B. Write a C function called check_time, which takes a pointer to a time_of_day structure as input, and return 1 if the time is valid (0 to 23 hours, 0 to 59 minutes, 0 to 59.999999 seconds) and 0 otherwise. Assume that times are...
***This is a complete question. Do not tag this as incomplete. Write SQL queries to the...
***This is a complete question. Do not tag this as incomplete. Write SQL queries to the below Relational Database. • Regarding the SQL queries: • Do not use SELECT * in any query. • Do not use any SQL features (including Nullif) that were not covered in this course. • Do not use subqueries IF joins can be used to answer a question. However, some questions may require the use of subqueries. The Movie Database Notes: TheaterNum, MovieNum, and ActorNum...