Search code examples
mysqlsqlpopsql

How to create an address variable in SQL?


I'm creating a table to catalogue information about customers at a car dealership. One of the variables is going to catalogue is a customer's address. What variable type in SQL could I use to store the address with a mix of words & numbers?


Solution

  • If you are looking for datatype of Address variable then Varchar would be the best choice since you can have digits, characters and special characters in it. For ex:

    George H. Washington
    1234 Main Street, Apartment 101
    Manvel, Texas, USA 77578
    

    Address like above can have commas and number and hypen in it.

    VARCHAR(255) would work but if you expect to address to be more than 255 then you can specify more like VARCHAR(500).