Change the Column in Table using Alias in Java Tutorial
Sometimes the names of columns are so technical that make the query’s output very difficult to understand. To give a column a descriptive name, you use a column alias.
This is all about Change the Column in Table using Alias in Java Tutorial. In this tutorial you will learn how to Change the Column in Table using Alias in Java Tutorial to make it more readable. It allows you to set your own title and display in the table. This tutorial uses table component in java and Netbeans IDE. Please follow all the steps below to complete this tutorial.
Change the Column in Table using Alias in Java Tutorial steps
First, you need to create a project by right clicking the file at the top left of the netbeans IDE and by selecting New Project you can name your project whatever you want, and then create your jframe form by right clicking the Source Packages and select New JFrame Form. After creating the form drag a table component in your form.
And then copy paste the code below and paste it inside initComponents Function
String sql = “SELECT product_name AS ‘Product Name’,company_name AS ‘Company Name’,date_of_sale AS ‘Date Purchased’,quantity AS ‘Quantity’,amount AS ‘Amount’ FROM sales_record”;
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
Then you’re done, run your project and see if it works.
Note the AS keyword is what make the alias work, it changed the column name in order to give a much more descriptive name.
About The Change the Column in Table using Alias In Java
|Project Name:||Change the Column in Table using Alias|
For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:
E-Mail: [email protected]
Contact No.: +639098911050
Ryan A. Salem
BSIT Graduate, soon to be MIT.
System Analyst / System Developer
Related topic(s) that you make like:
1.) How to use Scanner in Java Tutorial using Netbeans IDE
2.) Create Beautiful Bar Chart in Java Tutorial using Netbeans IDE