o Suppose we have a ClubMember table created by CREATE TABLE ClubMember ( id INT PRIMARY...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
o Suppose we have a ClubMember table created by CREATE TABLE ClubMember ( id INT PRIMARY KEY, name VARCHAR(40) NOT NULL, registerTime DATETIME NOT NULL ); INSERT INTO ClubMember VALUES (1, 'David', (2, 'Jessica', (3, 'Andy', (4, 'Jenny', (5, 'Bill', ¹2020-5-28 16:25'), ¹2020-5-28 17:10'), ¹2020-1-1 11:11'), '2019-12-30'), ¹2020-5-27 10:45'); and we would like to ask the following query questions: ■ Who registered with the club within 2 hours as David did? ■ Who registered on the same date as David? Then these two functions DATEADD and CONVERT can come to our assistance as the solutions may be formulated respectively by ■ SELECT id, name, registerTime FROM ClubMember WHERE name <> 'David' AND - exclude 'David' himself DATEADD(HOUR, -2, registerTime) <= '2020-5-28 16:25¹ AND DATEADD(HOUR, 2, registerTime) >= '2020-5-28 16:25¹; where DATEADD(HOUR, 2, register Time) is to add 2 hours to register Time. ■ SELECT 'Who registered on the same date as David did?' [Question 2]; SELECT id, name, registerTime, convert (DATE, registerTime) AS 'register date' FROM ClubMember WHERE name <> 'David' AND -- exclude 'David' himself CONVERT (DATE, registerTime) = CONVERT (DATE, '2020-5-28 16:25'); where CONVERT(DATE, register Time) is to keep only the date part of register Time, not its time part. o Suppose we have a ClubMember table created by CREATE TABLE ClubMember ( id INT PRIMARY KEY, name VARCHAR(40) NOT NULL, registerTime DATETIME NOT NULL ); INSERT INTO ClubMember VALUES (1, 'David', (2, 'Jessica', (3, 'Andy', (4, 'Jenny', (5, 'Bill', ¹2020-5-28 16:25'), ¹2020-5-28 17:10'), ¹2020-1-1 11:11'), '2019-12-30'), ¹2020-5-27 10:45'); and we would like to ask the following query questions: ■ Who registered with the club within 2 hours as David did? ■ Who registered on the same date as David? Then these two functions DATEADD and CONVERT can come to our assistance as the solutions may be formulated respectively by ■ SELECT id, name, registerTime FROM ClubMember WHERE name <> 'David' AND - exclude 'David' himself DATEADD(HOUR, -2, registerTime) <= '2020-5-28 16:25¹ AND DATEADD(HOUR, 2, registerTime) >= '2020-5-28 16:25¹; where DATEADD(HOUR, 2, register Time) is to add 2 hours to register Time. ■ SELECT 'Who registered on the same date as David did?' [Question 2]; SELECT id, name, registerTime, convert (DATE, registerTime) AS 'register date' FROM ClubMember WHERE name <> 'David' AND -- exclude 'David' himself CONVERT (DATE, registerTime) = CONVERT (DATE, '2020-5-28 16:25'); where CONVERT(DATE, register Time) is to keep only the date part of register Time, not its time part.
Expert Answer:
Answer rating: 100% (QA)
The image displays a SQL scenario involving a database table named ClubMember which contains member ... View the full answer
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date:
Students also viewed these programming questions
-
A company produces very unusual CD's for which the variable cost is $ 11 per CD and the fixed costs are $ 20,000. They will sell the CD's for $ 88 each. Letxbe the number of CD's produced. Write the...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The following information is available for Marigold's Hot Dogs: Actual production Budgeted production Standard direct labor hours Actual direct labor hours Standard variable overhead rate Actual...
-
Durham Company uses a job-order costing system. The following transactions took place last year: a. Raw materials requisitioned for use in production, $51,000 (75% direct and 25% indirect). b....
-
Use BPMN to depict Hoosier Burgers food-ordering system from Figure 7-5 as a business process model. Figure 7-5 CUSTOMER KITCHEN 1.0 Customer Order Receive and Transform Food Order Receipt Customer...
-
At December 31,2010, Inland Equipment understated ending inventory by $2,800. How does this error affect cost of goods sold and net income for 2010? a. Overstates cost of goods sold and understates...
-
In environmental engineering (a specialty area in civil engineering), the following equation can be used to compute the oxygen level c (mg/L) in a river downstream from a sewage discharge : c = 10 ...
-
A company receives $364, of which $23 is for sales tax. The journal entry to record the sale would include a ?
-
Complete Celebrity Catering Service Inc.s (CCS) Form 1120 and all related schedules. Be sure to attach schedules for any line item which indicates one is required on the 1120. FORM4562 is not...
-
Develop the ERD for a publishing company that wants a database to maintain authors and books. Each author may write several books. Some authors sign with the publishing company before they write...
-
The Ontario government has been making many changes to the Employment Standards Act. Most notably, has been the increase to minimum wage. What is the impact of these changes for small/large...
-
2. Determine the first root of the function f(x) = tet -0.3. Using two iterations of the bisection method to determine the root. Employ initial guesses of x = 1 and Xu 5. Compute the estimated error...
-
A solid sphere of radius 40.0 cm has a total positive charge of 25.3 C uniformly distributed throughout its volume. Calculate the magnitude of the electric field at the following distances. (a) 0 cm...
-
Suppose a portfolio manager wishes to construct a portfolio using two securities Coll and USR, both of their return data are shown in the Slide 5 with the title Hypothetical Investment Alternatives....
-
Mark was made an offer of employment based on the fact that he would submit a clean drivers abstract. His drivers abstract indicated that he had several traffic violations and several outstanding...
-
A large percentage of the firm's value is often found in the terminal value. The terminal value, in turn, is influenced by The perpetuity growth rate (PGR) that you assume. Thus, the PGR should be...
-
Explain briefly what is meant by electronic data interchange (EDI). How does EDI affect a companys audit trail?
-
Design an outline of a podcast for someone touring your university, college, or business. What sequence would you place the topics in? How much time would you allow for each campus or building...
-
Which test ensures data accuracy by the incorporation of a number in the code itself?
-
Define what is meant by stratification of samples.
-
Should government regulation of sport and business be increased, be decreased, or remain the same? Defend your position.
-
What guides your behavior now? Will you use one of the ethical guides from the text? If yes, which one and why?
-
Can ethics be taught and learned? Defend your position.
Study smarter with the SolutionInn App