Question

You can use either the CHAR data type or the VARCHAR data type to store character...

  1. You can use either the CHAR data type or the VARCHAR data type to store character data. What are the differences between the two? Are there any disadvantages to using VARCHAR?
  2. Ask students why the data type for POSTAL_CODE in the REP and CUSTOMER tables is CHAR and not SMALLINT or INTEGER? Is the length of the field large enough?

Homework Answers

Answer #1

CHAR: CHAR, also known as character, stores values in fixed length. If we store a string with a size less than the fixed length, then it is padded with space characters. It uses static memory allocation and can hold a maximum of 255 characters.

VARCHAR: VARCHAR, also known as variable character, stores values in variable length. They are not padded with any character. It uses dynamic memory allocation and can hold a maximum of 65535 characters.

POSTAL_CODE is stored with datatype CHAR because the value of POSTAL_CODE can be large enough, to be stored in INTEGER or SMALLINT. But as we know CHAR can store up to 255 characters, then it does not matter what the value is, because then each digit of POSTAL_CODE is stored as a single character.

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
Note: Do not use classes or any variables of type string to complete this assignment Write...
Note: Do not use classes or any variables of type string to complete this assignment Write a program that reads in a sequence of characters entered by the user and terminated by a period ('.'). Your program should allow the user to enter multiple lines of input by pressing the enter key at the end of each line. The program should print out a frequency table, sorted in decreasing order by number of occurences, listing each letter that ocurred along...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the codes below. Requirement: Goals for This Project:  Using class to model Abstract Data Type  OOP-Data Encapsulation You are asked to write an app to keep track of a relatively small music library. The app should load song information from a data file once the app is started. It should allow user to view, add, remove, and search for songs. The app should...
JAVA please Arrays are a very powerful data structure with which you must become very familiar....
JAVA please Arrays are a very powerful data structure with which you must become very familiar. Arrays hold more than one object. The objects must be of the same type. If the array is an integer array then all the objects in the array must be integers. The object in the array is associated with an integer index which can be used to locate the object. The first object of the array has index 0. There are many problems where...
please can you make it simple. For example using scanner or hard coding when it is...
please can you make it simple. For example using scanner or hard coding when it is a good idea instead of arrays and that stuff.Please just make one program (or class) and explain step by step. Also it was given to me a txt.htm 1.- Write a client program and a server program to implement the following simplified HTTP protocol based on TCP service. Please make sure your program supports multiple clients. The webpage file CS3700.htm is provided. You may...
Bivariate Data & Probability After completing the calculation by hand in Q1 you can use Excel...
Bivariate Data & Probability After completing the calculation by hand in Q1 you can use Excel to check your answers before submitting. Q2 assesses your general understanding of probability and linear associations using Excel to analyse a large dataset. Question 1       Covariance and Correlation The table below shows a set of sample bivariate data. Calculate the covariance and correlation coefficient by completing the below table. Show all working. X Y (X - ) (Y - ) (X - )(Y -...
Write a 4-6 sentence summary explaining how you can use STL templates to create real world...
Write a 4-6 sentence summary explaining how you can use STL templates to create real world applications. In your summary, provide an example of a software project that you can create using STL templates and provide a brief explanation of the STL templates you will use to create this project. After that you will implement the software project you described . Your application must be a unique project and must incorporate the use of an STL container and/or iterator and...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
Biology Unit I Homework - Nutritional Analysis Worksheet Introduction In Chapters 3 and 4 of the...
Biology Unit I Homework - Nutritional Analysis Worksheet Introduction In Chapters 3 and 4 of the textbook, you learned that the body needs various macro and micronutrients in order to function properly. You also learned about cellular metabolism and what the human body uses as a fuel source. This all seems simple at first glance; however, it can be difficult to determine whether we are getting what our body needs. Even when we know what our body needs, it becomes...
Please do not attempt to solve if you can not answer all!!! THE ENERGY BAR INDUSTRY...
Please do not attempt to solve if you can not answer all!!! THE ENERGY BAR INDUSTRY In 1986, PowerBar, a firm in Berkeley, California, single-handedly created the energy bar category. Positioned as an athletic energy food, it was distributed at bike shops and events that usually involved running or biking. The target segment was the athlete who needed an efficient, effective energy source. Six years later, seeking to provide an alternative to the sticky, dry nature of the PowerBar, a...