Creating SQL Tables: What Do I Need to Know?

  • Thread starter kolleamm
  • Start date
  • Tags
    Sql
In summary: It is commonly used for web applications and can be accessed through programming languages such as PHP and Java. MySQLWorkbench is a visual tool that can help with data modeling, SQL development, and database administration tasks. It can also be used to import and export data from Excel files. However, if you are looking for a program to organize your data in a similar way to Excel, you may want to consider using MS Access as a gateway tool between Excel and a full-fledged RDBMS. This can be a more cost-effective and simpler solution, depending on your needs.
  • #1
kolleamm
477
44
I created a database on my website, and now I'm guessing I have to add tables for the information. I have no idea what I'm looking at when I'm asked to create a table.
 

Attachments

  • img.png
    img.png
    18.3 KB · Views: 466
Technology news on Phys.org
  • #2
That's phpmyadmin, not SQL. I would ignore it, and learn how to interact with SQL directly.

Sql is like a programming language, and included in that is building commands. You can store all of this in a file and simply tell mysql to run the file.

myfile.sql
Code:
CREATE TABLE animals (
     id INT NOT NULL AUTO_INCREMENT,
     name CHAR(30) NOT NULL,
     PRIMARY KEY (id)
);

Code:
mysql -u'user' -p'password' < myfile.sql
You can also use a tool called MySQLWorkbench, which can do everything phpmyadmin can do, and a whole lot more.
 
  • Like
Likes kolleamm
  • #3
newjerseyrunner said:
That's phpmyadmin, not SQL. I would ignore it, and learn how to interact with SQL directly.

Sql is like a programming language, and included in that is building commands. You can store all of this in a file and simply tell mysql to run the file.

myfile.sql
Code:
CREATE TABLE animals (
     id INT NOT NULL AUTO_INCREMENT,
     name CHAR(30) NOT NULL,
     PRIMARY KEY (id)
);

Code:
mysql -u'user' -p'password' < myfile.sql
You can also use a tool called MySQLWorkbench, which can do everything phpmyadmin can do, and a whole lot more.
I need a program where I can organize my data similar to excel, would MySQLWorkbench be able to do this? Can excel create sql files?

Thanks in advance
 
  • #4
kolleamm said:
I created a database on my website, and now I'm guessing I have to add tables for the information. I have no idea what I'm looking at when I'm asked to create a table.

Table is a database construct that comprises of rows and columns. Columns have properties (like name, data type etc.) and each column is a property of a particular object (e.g. a person's surname, name, address etc.). Rows are essentially collections of values of various columns. Each row holds the data of a particular object (e.g. a person or any other). So, data and by extension information, is organized in the form of various tables in a database. In your attached image you have a snapshot of phpmyadmin. You have to fill in the values for the properties of each field that your table will have.

kolleamm said:
I need a program where I can organize my data similar to excel, would MySQLWorkbench be able to do this? Can excel create sql files?

Filling in the details in phpmyadmin, you will create your table(s) and then using PHP you can insert and retrieve data from there.

Now, MySQL Workbench is a visual tool that provides data modelling, SQL development and helps in administration tasks (like server configuration for MySQL server, user administration and other useful things). It is very helpful in designing your database in an easy (visual) way.

Excel cannot create sql-type files directly. Excel files can be transferred to a MySQL database by creating a .csv (Comma Separated Values) file from your Excel spreadsheet and then importing this file into your database using phpmyadmin. Also, you can save a MySQL file as .csv through phpmyadmin and import it to Excel. You can google it for the details.
 
  • #5
kolleamm said:
I need a program where I can organize my data similar to excel
A database may be overkill depending on why you are looking to move away from Excel. I suggest starting with MS Access as a gateway tool between Excel and a full-blown RDBMS.
 
  • #7
kolleamm said:
I need a program where I can organize my data similar to excel, would MySQLWorkbench be able to do this? Can excel create sql files?

Thanks in advance
There are import/export capabilities/wizards between Excel and SQL. Look up the import/export wizard in SQL Server and similar in Excel. If you want to export from Excel to SQL , you may have to do a bit of scripting if the receiving database schema is too different from the file, but you can also rewrite your database.
 
  • #8
I think a design plan would help here. Where do you see your needs now and in the future? How are you planning to access the data (now and in the future)? Does your environment require a secure environment? If you are doing a small scale project you might consider a used database server with a older version of sql server software. Those servers usually have Enterprise Manager installed to create tables, stored procedures, etc. Excel files can easily be imported into that system. It really depends on your data security and access requirements m
 

1. What is SQL?

SQL stands for Structured Query Language, and it is a programming language used for managing and manipulating data in relational databases. It allows users to create, insert, update, and retrieve data from databases.

2. How are SQL tables created?

SQL tables are created using the CREATE TABLE command, which specifies the table name and the columns and their data types. Optional parameters such as constraints and default values can also be specified.

3. What are the different data types that can be used in SQL tables?

The most commonly used data types in SQL tables are VARCHAR (variable-length character strings), INT (integer), FLOAT (floating-point number), and DATE (date and time values). There are also other data types available for specific purposes, such as BOOLEAN, TEXT, and BLOB.

4. How are relationships between SQL tables established?

Relationships between tables are established using foreign keys, which are columns that reference the primary key of another table. This allows for data to be connected and retrieved from multiple tables.

5. How are SQL tables modified or updated?

The data in SQL tables can be modified or updated using the INSERT, UPDATE, and DELETE commands. These commands allow for the addition of new data, the modification of existing data, and the removal of unwanted data, respectively.

Similar threads

  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
2
Replies
51
Views
4K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
7
Views
428
  • Programming and Computer Science
2
Replies
50
Views
4K
  • Programming and Computer Science
Replies
18
Views
3K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
4
Views
335
  • Programming and Computer Science
Replies
5
Views
5K
Back
Top