Char type refers to fixed size datatype. So if we declare it with 10 bytes, then it always stores 10 bytes in the database and it doesn’t matter whether we store any text or just empty 10 bytes
Varchar2 represents a datatype of variable size, it’s size depends on how many bytes you are actually going to store in the database. The number we specify is just the maximum number of bytes that can be stored. Minimum is 1 byte.
We should use CHAR when we know the exact length of the value in advance, database can then manipulate with it better and faster since it knows the exact length. Otherwise use VARCHAR2.
username VARCHAR2(255), zip_code CHAR(6) //Fixed size zip code
- What is DBMS?
- What is RDBMS?
- Difference between DBMS and RDBMS
- What are various DDL commands in SQL?
- What are various DML commands in SQL?
- What are various DCL commands in SQL?
- Can you sort a column using a column alias?
- Is a null value same as zero or a blank space if not then what is the difference?
- How can you eliminate duplicate rows from a query result?
- Difference between TRUNCATE, DELETE and DROP commands?
- What is the difference between CHAR and VARCHAR2 datatype in SQL?
- What are the differences between sql and pl/sql?
- What are the transaction properties in sql?
- What is the sql case statement used for?
- How many types of aggregate functions are there in sql?
- What are scalar functions in sql?
- What is the difference between sql and mysql?
- What is the use of nvl function in sql?
- What do you mean by subquery?
- What are Indexes in SQL?
- How to create index in oracle sql?
- How to view index in oracle sql?
- How to get list of tables in oracle sql
- Difference between clustered and nonclustered indexes in oracle sql?
- How to update with select subquery in sql server
- Explain different types of index in sql server