Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Adding addidional hard drive and attach it to a linux box. Linux/Unix
  • fkwoindex.sql /* Find FK without Index */ Oracle
  • .profile Linux/Unix
  • How to find the real execution plan and binds used in that explain plan in Oracle 10g?? Oracle
  • Find_planinfo.sql Oracle
  • Rman Notes -1 Oracle
  • alter database backup controlfile to trace Oracle
  • Oracle Data Direct to TAPE Oracle
  • SQL_PROFILE – I explaination Oracle
  • TNSNAMES entries details Oracle
  • Directory wise folder wise space usage Linux/Unix
  • Nice notes on wait events Oracle
  • Search and replace editor command in vi Linux/Unix
  • DBMS_PROFILER for tuning PLSQL programs. Oracle
  • Important Script Method for tuning Oracle

Getting started with notebook

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Getting started with notebook
# Databricks notebook source

 

%sql
create database if not exists abcdb

 

%sql
use abcdb

 

%sql
create table student (id int , name string)

 

%sql
insert into student
select 1 as id, ‘user1’ as name

 

%sql
select * from student

 

spark.sql(“create database if not exists xyzdb”)
spark.sql(“use xyzdb”)

 

# Use three double quotes (“””) if SQL you are using has multiple lines.
spark.sql(“”” create table student1
        ( id int,
        name string )”””)

 

spark.sql(“”” insert into student1
        select 2 as id, ‘test1’ as name””” )

 

# Different format of printing or displaying dataframe.

# Selecting rows from dataframe
spark.sql(“select * from student1”).display()
spark.sql(“select * from student1”).show()

# Storing result-set in collection
spark.sql(“select * from student1”).collect

# Describe schema and datatype
spark.sql(“select * from student1”).printSchema()

 
Python/PySpark

Post navigation

Previous Post: Read CSV file using PySpark
Next Post: Add new columns in dataframe

Related Posts

  • Read CSV File using Python Python/PySpark
  • Add new columns in dataframe Python/PySpark
  • Read CSV file using PySpark Python/PySpark
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Python class import from different folders Python/PySpark
  • Reading config file from other folder inside class Python/PySpark

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025
  • MYSQL and Oracle Comparison for Oracle DBA24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Physical Standby switchover with session active Oracle
  • chk_space_SID.ksh Linux/Unix
  • cold backup scripts to copy locally Linux/Unix
  • sql_doing_fts.sql Oracle
  • Drop specific SQL plan baseline – spm Oracle
  • how to find VIP from ifconfig Linux/Unix
  • Adding a new disk and mount it automatically. on VMWARE LINUX Linux/Unix
  • pvm_pre_change.sql Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme