About 102,000 results
Open links in new tab
  1. How can I declare this SQL table with a calculated field?

    Nov 24, 2010 · You can introduce a computed column: CREATE TABLE Son ( ID int primary key identity(1,1), DateOfBirth datetime, Age as DATEDIFF(year,DateOfBirth,GetDate()) - CASE WHEN DATEPART(month,DateOfBirth) > DATEPART(month,GetDate()) THEN 1 WHEN DATEPART(month,DateOfBirth) = DATEPART(month,GetDate()) And DATEPART(day,DateOfBirth) > DATEPART(day,GetDate ...

  2. Calculating values of derived attributes in SQL - Stack Overflow

    The 2nd, 3rd and 4th attributes of bill specify 3 items with different ItemID and the 5th, 6th and 7th attributes specify their respective quantities. I want to calculate the price of each item by multiplying with their respective quantities with their Price(taken from the 'item' table) and then add their individual prices and save the result ...

  3. Derived Attribute in DBMS - GeeksforGeeks

    May 6, 2024 · Derived attributes are the attributes that can be derived from the other attribute. These attributes are not present in the database physically but they can be derived from the other attributes easily.

  4. sql - MySQL Calculate Derived Attribute - Stack Overflow

    You can't have a computed column "as is" in mysql. Three solutions : First: use triggers. see for example column calculated from another column. Second: create a view (Fine will exist only in your view, not in your main table). view can contain computed columns without any problem.

  5. Specify computed columns in a table - SQL Server

    Feb 4, 2025 · A computed column expression can use data from other columns to calculate a value for the column to which it belongs. You can specify an expression for a computed column in SQL Server by using SQL Server Management Studio (SSMS) or Transact-SQL (T-SQL).

  6. An Essential Guide to SQL Server Computed Columns By Examples

    Fortunately, SQL Server provides us with a feature called computed columns that allows you to add a new column to a table with the value derived from the values of other columns in the same table. For example, you can add the full_name column to the persons table by using the ALTER TABLE ADD column as follows:

  7. How to Use Calculated Fields Effectively in SQL Databases

    Jan 14, 2025 · Calculated fields are columns that don’t physically exist in a database table, but are dynamically created when a query is executed. This allows users to perform mathematical operations or string manipulations on existing data, generating new values from existing columns.

  8. MySQL: How to add a calculated column to SELECT query

    Feb 19, 2024 · Adding a calculated column in a SELECT query lets you create dynamic columns on the fly, based on the value in the existing columns. This feature is incredibly useful for generating reports, conducting on-the-fly calculations, or simply making your data more insightful without altering your database schema.

  9. How to Implement Calculated Fields in SQL - DevCamp

    This guide provides a step by step walk through for how to build a SQL query with calculated fields. This will allow you to perform mathematical calculations on data in the database at query time to build summary reports.

  10. Create a Calculated Attribute in an Aggregate - OutSystems

    Feb 20, 2025 · In the Aggregate, click New Attribute to add a new attribute to the Aggregate and name it. Open the attribute menu and select Edit formula... Define the expression to calculate the value. You can also calculate new attributes based on other calculated attributes.

Refresh