Question
Download Solution PDFAn attribute A of data type varchar(20) has the value ‘xyz’ and attribute B of data type char(20) has the value “Imnop” , then the attribute A has ________ spaces and attribute B has ________ spaces.
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFChar and varchar types are similar but differ in their storing and retrieval way. They also have different maximum length.
Explanation:
Char: When char is declared with a length than its length is fixed with that is declared during the creation of the table. Some points about char:
- It has fixed length,
- It loads empty spaces.
- Length ranges from 0 to 255
- When char values are stored, they are right padded with spaces to the specified length.
Varchar: Values in varchar columns are of variable length. Some points about varchar are as follows:
- Length can be specified from 0 to 65535.
- The effective maximum length is subject to maximum row size
- Varchar values are stored as 1 byte or 2 byte length prefix plus data.
- It doesn’t use the entire declared length.
Last updated on Jun 19, 2025
-> The UGC NET City Slip 2025 has been released on its official website today.
-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.
-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.
-> The exam is conducted bi-annually - in June and December cycles.
-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions.
-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.