<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can I create a column on the fly which would have same value for all rows in spark sql query in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-column-on-the-fly-which-would-have-same-value/m-p/16496#M10676</link>
    <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I have a SQL query which I am converting into spark sql in azure databricks running in my jupyter notebook. In my SQL query, a column named Type is created on the fly which has value 'Goal' for every row:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;SELECT Type='Goal', Value &lt;P&gt;&lt;/P&gt;FROM table&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;Now, when I am using the same syntax on the spark sql in my azure databricks notebook, it gives me an error: &lt;P&gt;&lt;/P&gt;Error in SQL statement: AnalysisException: cannot resolve '`Type`' given input columns:
&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;How can I convert the same logic in azure databrick spark sql 
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Aug 2021 18:46:43 GMT</pubDate>
    <dc:creator>haseebkhan1421</dc:creator>
    <dc:date>2021-08-15T18:46:43Z</dc:date>
    <item>
      <title>How can I create a column on the fly which would have same value for all rows in spark sql query</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-column-on-the-fly-which-would-have-same-value/m-p/16496#M10676</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I have a SQL query which I am converting into spark sql in azure databricks running in my jupyter notebook. In my SQL query, a column named Type is created on the fly which has value 'Goal' for every row:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;SELECT Type='Goal', Value &lt;P&gt;&lt;/P&gt;FROM table&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;Now, when I am using the same syntax on the spark sql in my azure databricks notebook, it gives me an error: &lt;P&gt;&lt;/P&gt;Error in SQL statement: AnalysisException: cannot resolve '`Type`' given input columns:
&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;How can I convert the same logic in azure databrick spark sql 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Aug 2021 18:46:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-column-on-the-fly-which-would-have-same-value/m-p/16496#M10676</guid>
      <dc:creator>haseebkhan1421</dc:creator>
      <dc:date>2021-08-15T18:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a column on the fly which would have same value for all rows in spark sql query</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-column-on-the-fly-which-would-have-same-value/m-p/16497#M10677</link>
      <description>&lt;P&gt;The correct syntax would be: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT 'Goal' AS Type, Value 
FROM table&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 21:24:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-create-a-column-on-the-fly-which-would-have-same-value/m-p/16497#M10677</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2021-09-01T21:24:20Z</dc:date>
    </item>
  </channel>
</rss>

