Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

SHORTAND NOTATION FOR RELATIONAL SQL TABLES | Notation | Example | Meaning Underlined AorA,B The attribute(s) is CREATE TABLE R (are) a primary key ( A <any SQL type>, Superscript name AF or A®, B® The attribute(s) is B <any SQL type>, of relation (are) a foreign key C <any SQL type>, referencing D <any SQL type>, relation R E <any SQL type>, PRIMARY KEY(A), As an example, the schema FOREIGN KEY (E) REFERENCES S(F) ); R(A, B, C, D, E5) S(E, G, H) CREATE TABLE S ( F <any SQL type>, j

Computer Science May 28, 2022

SHORTAND NOTATION FOR RELATIONAL SQL TABLES

| Notation | Example | Meaning

Underlined AorA,B The attribute(s) is CREATE TABLE R

(are) a primary key ( A <any SQL type>,

Superscript name AF or A®, B® The attribute(s) is B <any SQL type>,

of relation (are) a foreign key C <any SQL type>,

referencing D <any SQL type>,

relation R E <any SQL type>,

PRIMARY KEY(A),

As an example, the schema FOREIGN KEY (E) REFERENCES S(F)

);

R(A, B, C, D, E5)

S(E, G, H) CREATE TABLE S

( F <any SQL type>,

j . G <any SQL type>,

corresponds to the following SQL tables: H <any SQL type>,

PRIMARY KEY(F))

EXERCISE

Consider the following relational schema, representing five relations describing shopping transactions and information about credit cards generating them [the used notation is explained above].

SHOPPINGTRANSACTION (Transld, Date, Amount, Currency, ExchangeRate, CardNbr@®2"A?°, storeid>OFF)

CREDITCARD (CardNbr, CardType“®°™§, CardOwnerNE, ExpDate, Limit)

OWNER (Ownerld, Name, Surname, BirthDate, Job, IncomeLevel, Level)

CARDTYPE (CardType, Circuit, Issuer, Address, Country, CardName, Color)

STORE (Storeld, Name, Address, Country, Zone, Web, Email, Type)

1) Answer the following questions considering the domain described by the previous relational schema:

1.1. How many transactions can occur in each store? (provide the minimum and the maximum number)

1.2. How many credit cards with the same owner and the same type can exist? (provide the minimum and the maximum number)

2) Write the SQL query representing the following request:

2.1. Determine the number and the expire date of the credit cards with a limit equal to 2.000, that have not generated any transaction in 2022.
Provide the correct input to have the program print the sentence:

Exactly! Good Job.

Before submitting your answer, please check its correctness by executing the code.

#include <stdio.h>

#include <inttypes.h>

#include <stdlib.h>

static int64_t metallica[] = { 32538, 37741, 89540, 14627, 34272, 58765 };

const static int N = sizeof (metallica) /sizeof (*metallica);

static void fail () {

puts ("Nope!");

exit (EXIT_FAILURE) ;

}

static void the_beatles(int64_t h, int64_t s, int64_t i){

if (h-i/7+3%* s/i1il)

fail();

}

static void anthrax(int z, int64_t }j) {

int64_t p = j;

for(; z<N; ++z) {

if ((z % 2) == 0)

continue;

p += metallica[z];

}

if (p != 69857)

fail();

}

static void eagles(int k, inté4_t d){

if (k<N) {

if (k % 2)

eagles (++k, d);

else eagles(k + 1, d * metallica([k]);

} else if (d != 1269229500)

fail();

}

int main () {

int64_t a, e, y;

printf("Please enter the right three numbers: ");

fflush (stdout) ;

if (scanf("%" SCNd64 " %" SCNd64 " %" SCNd64, &a, &e, &Y) != 3)

fail();

metallica[0] = a;

metallica[5] = e;

metallica[4] = y;

anthrax(0, 15916);

eagles(1, 9);

the_beatles(a, e, y);

puts ("Exactly! Good job.");

}

Expert Solution

For detailed step-by-step solution, place custom order now.
Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment