Question

In: Computer Science

(PHP and MySQL) How do you determine what size (in terms of subtype or length) a...

(PHP and MySQL)

How do you determine what size (in terms of subtype or length) a column should be?

What are some of the other properties that can be assigned to columns?

What is a primary key?

if you`re using the command-line myaql client to connect to MySQL,What username and password combination is required?

Solutions

Expert Solution

Solution:

For MySql:

36

If you want to find out the size of column=COLUMN_NAME from table=TABLE_NAME, you can always run a query like this:

SELECT sum(char_length(COLUMN_NAME)) 
FROM TABLE_NAME;

Size returned is in bytes. If you want it in kb, you could just divide it by 1024, like so:

SELECT sum(char_length(COLUMN_NAME))/1024 
FROM TABLE_NAME;

To define SQL Server table column properties:

  1. Right-click a column in the Model Explorer and click Properties.

    The SQL Server Table Column Editor opens.

  2. Select the table from the Table drop-down to define the columns that are available for the table.

Select the column in the Navigation Grid that you want to define and work with the following options:

Note: Click New on the toolbar to create a new column. Use the Enter filter text box to filter a very large list of columns to quickly locate the one that you want to define.

  • Physical NameSpecifies the physical name of the column. You can change the name of the column in this field.
  • Domain Parent
  • Specifies the domain parent of the column. Select the domain parent from the drop-down list.
  • Physical Data Type
  • Specifies the physical data type for the selected column. Select a physical data type from the drop-down list.
  • Primary Key
  • Specifies to designate the selected column as a primary key column. Select the check box to enable this option.
  • Physical Only
  • Specifies whether the column is suppressed from a logical model (as an attribute) and appears in a physical model only.
  • Foreign Key
  • Specifies to designate the selected column as a foreign key column. Select the check box to enable this option

Primary Key:

The PRIMARY KEY constraint uniquely identifies each record in a table.

Primary keys must contain UNIQUE values, and cannot contain NULL values.

A table can have only ONE primary key; and in the table, this primary key can consist of single or multiple columns (fields).

UserName and Password:

An account may also have authentication credentials such as a password. The credentials are handled by the account authentication plugin. MySQL supports multiple authentication plugins. Some of them use built-in authentication methods, whereas others enable authentication using external authentication methods

There are several distinctions between the way user names and passwords are used by MySQL and your operating system:

  • User names, as used by MySQL for authentication purposes, have nothing to do with user names (login names) as used by Windows or Unix. On Unix, most MySQL clients by default try to log in using the current Unix user name as the MySQL user name, but that is for convenience only. The default can be overridden easily, because client programs permit any user name to be specified with a -u or --user option. This means that anyone can attempt to connect to the server using any user name, so you cannot make a database secure in any way unless all MySQL accounts have passwords. Anyone who specifies a user name for an account that has no password can connect successfully to the server.

  • MySQL user names are up to 32 characters long. Operating system user names may have a different maximum length.

  • To authenticate client connections for accounts that use built-in authentication methods, the server uses passwords stored in the user table. These passwords are distinct from passwords for logging in to your operating system. There is no necessary connection between the “external” password you use to log in to a Windows or Unix machine and the password you use to access the MySQL server on that machine.
  • If the server authenticates a client using some other plugin, the authentication method that the plugin implements may or may not use a password stored in the user table. In this case, it is possible that an external password is also used to authenticate to the MySQL server.

To connect to a MySQL server with a command-line client, specify user name and password options as necessary for the account that you want to use:

shell> mysql --user=finley --password db_name


Related Solutions

Using PHP and MYSQL and with a simple customer database, how can I create a simple...
Using PHP and MYSQL and with a simple customer database, how can I create a simple log in and registration system for an ecommerce site
How do you determine the length of your forecasting period?
How do you determine the length of your forecasting period?
PHP, JAVASCRIPT, MYSQL below is what I have. Can fill in the details for the database...
PHP, JAVASCRIPT, MYSQL below is what I have. Can fill in the details for the database 5. “Login to DB”, “Logout DB”, sub-menus of “File” 5.1 _____ When the user selects “Login to DB”, a window should popup asking the user to enter login and password. Your program should verify the login and password against the DV_User table in the datamining database. A corresponding message should be shown in the message area when the login failed or successful. If it...
What do the terms "diversity" and "health disparities" mean to you? How are the two terms...
What do the terms "diversity" and "health disparities" mean to you? How are the two terms related? How are these terms relevant to health program planning and evaluation? How does the cultural diversity of populations affect the program planning and evaluation processes? Explain these in terms of the various stages of the planning and evaluation cycle.
What do the terms "diversity" and "health disparities" mean to you? How are the two terms...
What do the terms "diversity" and "health disparities" mean to you? How are the two terms related? How are these terms relevant to health program planning and evaluation? How does the cultural diversity of populations affect the program planning and evaluation processes? Explain these in terms of the various stages of the planning and evaluation cycle.
What is meant by the term "arm’s length," and how do you see it as important...
What is meant by the term "arm’s length," and how do you see it as important in tax planning? In what ways can a stock redemption be classified? In a stock redemption, would corporate and noncorporate shareholders have the same preference for tax treatment? Explain your response.
What kind of asset is goodwill? How do you determine the amount of goodwill? How do...
What kind of asset is goodwill? How do you determine the amount of goodwill? How do you treat goodwill subsequent to its acquisition?
By using arc-length, determine the angular size of the Moon as seen from Earth. Also, determine...
By using arc-length, determine the angular size of the Moon as seen from Earth. Also, determine the angular size of the Sun as seen from Earth. show full steps please
How do you determine the average cost of capital before taxation? How do you determine the...
How do you determine the average cost of capital before taxation? How do you determine the average cost of capital after taxation? Own Capital R500 000 Longterm loan R150 000 15% p.a. Bank overdraft R50 000 12% p.a. Trade payables R80 000 Taxation rate 28% p.a. After taxation rate of return required on capital 20% p.a.
In terms of disposition of a product what do you do at the end of a...
In terms of disposition of a product what do you do at the end of a products life cycle? What do you do with your shoes, phones, laptops? Do you recycle them, donate them, hang on to them for future use? Have you ever gotten rid of a product and wish you'd kept it? Have you ever kept a product and wish you'd gotten rid of it sooner? What products do you feel that you've gotten every ounce of life...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT