Question

Customer Transaction Table – CUSTOMER_TXNS Column Name Description Type Account_id Account identifier Integer Txn_timestamp Time of...

Customer Transaction Table – CUSTOMER_TXNS

Column Name

Description

Type

Account_id

Account identifier

Integer

Txn_timestamp

Time of transaction (UTC)

Timestamp

Product_id

The id of the product purchased

Integer

Txn_Amt

The revenue amount of the transaction

Float

Txn_Qty

The number of items purchased

Integer

NOTE: Customer Transaction table has multiple records per account_id.

Customer Master Table – CUSTOMER_MSTR

Column Name

Description

Type

Account_id

Account identifier

Integer

Country

Country Code

Character(3)

Address

Address of the customer

Character(64)

Registerd_Dt

Date the account id was first used

Date

Tier

Account Tier

Integer

NOTE: Customer Master table has one record per account_id.

A database administrator wants to create an index on the address column in the CUSTOMER_MSTR table. Their statement is below:

CREATE INDEX ADDRESS ON CUSTOMER_MSTR (Address(64));

You think the index can be a lot shorter and therefore more efficient. Write an example SQL query that you could run to show that an index based on Address with a length of 32 characters is just as good as one with a length of 64 characters.

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

One of the possible queries would be:

SELECT * FROM CUSTOMER_MSTR WHERE Address LIKE '12%';

Add a comment
Know the answer?
Add Answer to:
Customer Transaction Table – CUSTOMER_TXNS Column Name Description Type Account_id Account identifier Integer Txn_timestamp Time of...
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
  • CREATE TABLE customer (    id INTEGER PRIMARY KEY,    customer_name TEXT,    contact_number TEXT );...

    CREATE TABLE customer (    id INTEGER PRIMARY KEY,    customer_name TEXT,    contact_number TEXT ); CREATE TABLE supplier (    id INTEGER PRIMARY KEY,    supplier_name TEXT UNIQUE,    contact_number TEXT ); CREATE TABLE product (    id INTEGER PRIMARY KEY,    supplier_id INTEGER REFERENCES supplier(id),    product_name TEXT,    product_price INTEGER,    UNIQUE(supplier_id, product_name) ); CREATE TABLE purchase (    id INTEGER PRIMARY KEY,    customer_id INTEGER REFERENCES customer(id),    purchase_date REAL,    store_id INTEGER REFERENCES store(id) );...

  • Write SQL to create a table called City in your account. The schema of the table...

    Write SQL to create a table called City in your account. The schema of the table is listed below. You must define the data types and not null constraint (if needed) of every column and all the primary key and foreign key constraints for the table. No screenshot needed for this question. City (Name, Country, Population, Capital). Name: the name of the city. Text string with maximum 50 characters. Must not be null. Country: the name of the country where...

  • use workbench please Task 1: Create a database and name it practical2DB. (2 marks) Task 2:...

    use workbench please Task 1: Create a database and name it practical2DB. (2 marks) Task 2: Create all the four tables according to the relational scheme in Figure 1. (8 marks) Task 3: Insert 5 records to into each table. (5 marks) Task 4: Write a query to list alphabetically ordered names, addresses, and IDs of all the customers whose postcode is in (40150, 40400, 47500). (10 marks) Task 5: Delete 1 record from Products table using their primary keys....

  • user_id name AppUser birthday owns ISA 7 supervises album_id phone worker name Album Customer Admin supervisor...

    user_id name AppUser birthday owns ISA 7 supervises album_id phone worker name Album Customer Admin supervisor pic creation_date contains places manages image_id order_id Image Print Order filename status amount description contains item_id (product_id IC price quantity Item prints-on Product i subtotal prints Relational table schema (with data type) AppUser (user id: Int, name: VARCHAR(80)) Foreign keys: none Customer (user id: Int, birthday: DATE) Foreign keys: user_id refers AppUser CustomerPhone (user id: INT, phone: VARCHAR(20)) Foreign keys: user_id refers Customer Admin...

  • rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name...

    rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name varchar(25) student last name major_id integer the ID of the student's major; a foreign key for the major_id in the rider_major table rider_major Column Data Type Description major_id integer the primary key major_name varchar(50) student first name major_description varchar(100) student last name Use the Tables above to answer the questions. Questions: 1. Write a SQL statement to add a student record to the rider_student...

  • Lesson 10Create the DEPARTMENT tables based on the following: Column Name   ID      Name Data Type     Number...

    Lesson 10Create the DEPARTMENT tables based on the following: Column Name   ID      Name Data Type     Number Varchar2 Length        7      25 Populate the DEPARTMENT table with data from the DEPT table. Include only columns that you need. Create the EMPLOYEE table based on the following table chart: Column Name    ID      LAST_NAME     FIRST_NAME     DEPT_ID Data Type      Number Varchar2      Varchar2       Number Length         7       25            25             7 Modify the EMPLOYEE table to allow for longer employee last names. Confirm your modification. Confirm that both the...

  • 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...

  • CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People (...

    CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People ( ID INT, name VARCHAR(50), gender CHAR(1), height FLOAT, PRIMARY KEY (ID), FOREIGN KEY (gender) REFERENCES Gender (gender) ); CREATE TABLE Sports ( ID INT, name VARCHAR(50), record FLOAT, PRIMARY KEY (ID), UNIQUE (name) ); CREATE TABLE Competitions ( ID INT, place VARCHAR(50), held DATE, PRIMARY KEY (ID) ); CREATE TABLE Results ( peopleID INT NOT NULL, competitionID INT NOT NULL, sportID INT NOT NULL,...

  • Using the tables provided above, provide SQL statements for the following queries. NOTE: YOU DO NOT NEED TO INSERT MOR...

    Using the tables provided above, provide SQL statements for the following queries. NOTE: YOU DO NOT NEED TO INSERT MORE DATA INTO THE TABLES. The list of tables available for this assignment is the following MODEL(modellD, economySeats, buisnessSeats, firstClassSeats, cargoCapacity, fuelCapacity, length, wingspan, serviceHours) LOCATION(airportCode, country, address, phone) TICKET ticketNum, luggageLimit, seatNum, classCode, medicalCondition, mealChoice, customerlD, flightID) ROUTE(routelD, description, arriveAirportCode, departAirportCode) IRREGULAR_EVENT(eventNumber,flightlD, eventDate TIme, eventDescription) SERVICE(serviceDate,airfD, description, cost) AIRCRAFT (aicraftlD, mailCargoCapacity, numMedPacks, numDefibritlators, haulType, modellD NEACC MEMBER(memberlD, flightGoldPoints) STAFF(stafflD, name,...

  • Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make t...

    Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make the following modifications: For the vendors table: Comment out the table-level primary key Change the VendorIDcolumn to be a column-level primary key Add a VendorEmail column to the bottom of the table definition (define the data type for the column as variable character and set it to not exceed 45 characters) After the lineItems table, add code to create a table...

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